Как создать int-http: исходящий-шлюз без конфигурации xml - PullRequest
0 голосов
/ 08 мая 2019

Как преобразовать нижеприведенную конфигурацию XML интеграции Spring в bean-компоненты конфигурации Java.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration"
       xmlns:int-http="http://www.springframework.org/schema/integration/http"
       xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/integration
    http://www.springframework.org/schema/integration/spring-integration.xsd
    http://www.springframework.org/schema/integration/http
    http://www.springframework.org/schema/integration/http/spring-integration-http.xsd">

    <int:channel id='reply.channel'>
        <int:queue capacity='10' />
    </int:channel>
    <int:channel id='get.request.channel'/>

    <int-http:outbound-gateway id="outbound.gateway"
                               request-channel="get.request.channel" url="{fhirurl}"
                               http-method-expression="payload.getHttpMethod()" expected-response-type-expression="payload.getResponseType()"
                               charset="UTF-8" reply-timeout="5000" reply-channel="reply.channel">

        <int-http:uri-variable name="fhirurl" expression="payload.getUrl()"/>

    </int-http:outbound-gateway>

</beans>

Я получил код ниже, но не могу его использовать. Можете ли вы мне помочь, что написать в soapHeaderMapper и requestFactory

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

Заранее спасибо

...