简体   繁体   中英

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"/>
@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;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM