Example usage for org.springframework.integration.gateway GatewayProxyFactoryBean GatewayProxyFactoryBean

List of usage examples for org.springframework.integration.gateway GatewayProxyFactoryBean GatewayProxyFactoryBean

Introduction

In this page you can find the example usage for org.springframework.integration.gateway GatewayProxyFactoryBean GatewayProxyFactoryBean.

Prototype

public GatewayProxyFactoryBean() 

Source Link

Document

Create a Factory whose service interface type can be configured by setter injection.

Usage

From source file:org.acme.echo.module.ModuleGatewayRequestExchanger.java

@Override
public void afterPropertiesSet() throws Exception {
    GatewayProxyFactoryBean gatewayFactory = new GatewayProxyFactoryBean();
    String requestChannel = "echoStartChannel"; // we might want to get from some module.properties file
    String replyChannel = "echoEndChannel";
    gatewayFactory.setDefaultRequestChannel(moduleContext.getBean(requestChannel, MessageChannel.class));
    gatewayFactory.setDefaultReplyChannel(moduleContext.getBean(replyChannel, MessageChannel.class));
    gatewayFactory.afterPropertiesSet();
    requestReplyExchanger = (RequestReplyExchanger) gatewayFactory.getObject();
}

From source file:com.acmemotors.batch.LoaderJobConfiguration.java

@Bean
public GatewayProxyFactoryBean gatewayProxyFactoryBean() {
    GatewayProxyFactoryBean gatewayProxyFactoryBean = new GatewayProxyFactoryBean();
    gatewayProxyFactoryBean.setServiceInterface(RequestGateway.class);
    gatewayProxyFactoryBean.setDefaultRequestChannel(requestChannel());
    gatewayProxyFactoryBean.setDefaultReplyTimeout(5000l);
    return gatewayProxyFactoryBean;
}

From source file:org.springframework.integration.handler.MethodInvokingMessageProcessorTests.java

@Test
public void gatewayTest() throws Exception {
    GatewayProxyFactoryBean gwFactoryBean = new GatewayProxyFactoryBean();
    gwFactoryBean.afterPropertiesSet();//w ww  .  jav  a  2s  .  co m
    Object target = gwFactoryBean.getObject();
    // just instantiate a helper with a simple target; we're going to invoke getTargetClass with reflection
    MessagingMethodInvokerHelper helper = new MessagingMethodInvokerHelper(new TestErrorService(), "error",
            true);

    Method method = MessagingMethodInvokerHelper.class.getDeclaredMethod("getTargetClass", Object.class);
    method.setAccessible(true);
    Object result = method.invoke(helper, target);
    assertSame(RequestReplyExchanger.class, result);
}