Первое сообщение. Я новичок в Spring Integration и имею следующий сценарий: У меня есть служба «xyzSearchService.getXYZ», которая вызывается в результате входящего HTTP-запроса. Выполняет некоторую логику, затем вызывает «routingChannel», который, в свою очередь, вызывает службу геокодирования google.spring-integration конечная точка
Я хочу, чтобы ответ от google возвращался в xyzSearchService.getXYZ, но я не уверен, как настроить answerChannel в «исходящей ссылке». Теперь я перехожу к другому методу в той же службе, где я могу видеть результаты, но я хочу, чтобы он возвращался к вызываемому ему сервису/методу. Не знаете, как настроить мой последний адаптер исходящего канала?
<int-http:inbound-gateway id="inboundXYZSearchRequestGateway"
supported-methods="GET, POST"
request-channel="xyzSearchRequest"
reply-channel="xyzSearchResponse"
mapped-response-headers="Return-Status, Return-Status-Msg, HTTP_RESPONSE_HEADERS"
view-name="/xyz"
path="/services/xyz/zip/{zipcode}/search"
reply-timeout="50000">
<int-http:header name="zipcode" expression="#pathVariables.zipcode"/>
</int-http:inbound-gateway>
<int:service-activator id="xyzServiceActivator"
input-channel="xyzSearchRequest"
output-channel="xyzSearchResponse"
ref="xyzSearchService"
method="getXYZ"
requires-reply="true"
send-timeout="60000"/>
//the service activator method does some logic and invokes the "routingChannel"
<int:chain input-channel="routingChannel">
<int:router
expression="payload.serviceType"
default-output-channel="channel_default"
resolution-required="false">
</int:router>
</int:chain>
<int-http:outbound-gateway id="outboundGateway"
url="http://maps.googleapis.com/maps/api/geocode/json?address={zipCode}"
http-method="GET"
request-factory="requestFactory"
request-channel="restchannel"
reply-channel="channel2"
expected-response-type="java.lang.String">
<int-http:uri-variable name="zipCode" `enter code `enter code here`here`expression="payload.data['zipcode']"/>
</int-http:outbound-gateway>
<int:channel id="channel2"/>
<int:outbound-channel-adapter channel="channel2" ref="xyzSearchService" method="routeUnit" />
EDIT:
вы предлагаете ли я создать входящий-шлюз, так и вызывать, что из моего метода службы?
<int-http:inbound-gateway id="inboundNewZipRequestGateway"
supported-methods="GET, POST"
request-channel="zipRoutingChannel"
reply-channel="zipSearchResponse"
mapped-response-headers="Return-Status, Return-Status-Msg, HTTP_RESPONSE_HEADERS"
view-name="/zip"
path="/services/zip/zipcode/{zipcode}/search"
reply-timeout="50000">
<int-http:header name="zipcode" expression="#pathVariables.zipcode"/>
</int-http:inbound-gateway>
EDIT:
я добавил шлюз следующим образом:
<int:gateway id="toHttp" service-interface="com.....domain.MyGW"
default-request-channel="routingChannel"
default-reply-timeout="55550" ></int:gateway>
Был autowire должен выглядеть следующим образом ?:
@Autowired
private MyGW toHttp;
или
@Autowired
private MyGW gateway;
Я бывший:
Message<?> reply = toHttp.callHttp(inMessage);
Я не думаю, что это собирание routingChannel однако.
Вы предлагаете настроить входящий-шлюз следующим образом: <ИНТ-Http: въездной-идентификатор шлюз = "inZipGate" поддерживаемых-метода = "GET, POST" запроса канал = "zipRoutingChannel" ответ-канал = "zipSearchResponse" mapped-response-headers = "Return-Status, Return-Status-Msg, HTTP_RESPONSE_HEADERS" view-name = "/ zip" path = "/../ {zipcode}/search" reply- timeout = "50000"> – MrWilliams
Пожалуйста, не добавляйте код в комментарии; как вы можете видеть, это невозможно прочитать. Пожалуйста, отредактируйте вопрос вместо этого, и тогда я напишу ваш комментарий. –
Все еще учитесь писать здесь ... оцените вашу помощь. – MrWilliams