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

后端 未结 1 2072
醉酒成梦
醉酒成梦 2021-02-10 00:44

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



        
1条回答
  •  生来不讨喜
    2021-02-10 01:16

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

    0 讨论(0)
提交回复
热议问题