Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create http outbound-gateway with JAVA config in Spring integration?

I have the following http outbound gateway. How can I do this configuration with Java Config or Spring DSL?

<int-http:outbound-gateway id="test"
                           url="http://localhost:8080/"
                           http-method="POST"
                           charset="UTF-8"
                           header-mapper="soapHeaderMapper"
                           request-factory="requestFactory"
                           request-channel="inputChannel"/>
like image 810
user1552545 Avatar asked Mar 17 '16 08:03

user1552545


1 Answers

@Bean
public IntegrationFlow httpOut() {
    return IntegrationFlows.from("inputChannel")
            .handle(Http.outboundGateway("http://localhost:8080/")
                    .charset("UTF-8")
                    .httpMethod(HttpMethod.POST)
                    .headerMapper(soapHeaderMapper())
                    .requestFactory(requestFactory()), e -> e.id("test"))
            .get();
}

Or

@ServiceActivator(inputChannel="inputChannel")
@Bean(name="test")
public MessageHandler httpout() {
    HttpRequestExecutingMessageHandler handler = new ...
    ...
    return handler;
}
like image 178
Gary Russell Avatar answered Sep 21 '22 15:09

Gary Russell