出站网关不消耗回复

时间:2019-06-03 07:58:50

标签: spring spring-integration spring-jms

有两个服务通过JMS相互通信。 S1通过出站网关呼叫S2。该请求被发送到S2,后者使用Message(消息驱动通道适配器)并创建一个带有响应数据的新GenericMessage。该答复被发送(出站信道适配器)给S1,但未被使用。

当我让S2返回请求的原始JMS消息时,它被S1用作回复。创建一个新的(即使复制JMS标头数据也是如此)不是。我做错了什么?

S1:

<int:gateway service-interface="de.embunit.booky.webgateway.integration.ServiceGateway"
             id ="jmsServiceGateway" default-reply-timeout="3000" default-request-timeout="3000">
    <int:method name="placeOrder"
                    request-channel="cnlGatewayPlaceOrderRequest"
                    reply-channel="cnlGatewayPlaceOrderResponse" />
</int:gateway>

<int:chain input-channel="cnlGatewayPlaceOrderRequest" output-channel="cnlGatewayPlaceOrderResponse">
    <int:object-to-json-transformer content-type="application/json" />
    <jms:outbound-gateway request-destination="GATEWAY_PLACE_ORDER_REQUEST" request-pub-sub-domain="true" correlation-key="JMSCorrelationID"
                          reply-destination="GATEWAY_PLACE_ORDER_RESPONSE" reply-pub-sub-domain="true"
                          receive-timeout="3000" connection-factory="jmsConnectionFactory"/>
    <int:transformer id="idReplyTransformer" ref="replyTransformer" method="convert"/>
</int:chain>

S2:

<jms:message-driven-channel-adapter id="jmsGatewayPlaceOrderRequest"
                                    destination="GATEWAY_PLACE_ORDER_REQUEST" channel="cnlGatewayPlaceOrderRequestCustGranted"
                                    acknowledge="auto" pub-sub-domain="true"
                                    connection-factory="jmsConnectionFactory"/>

<jms:outbound-channel-adapter id="jmsGatewayPlaceOrderResponse"  pub-sub-domain="true"
                              destination="GATEWAY_PLACE_ORDER_RESPONSE" channel="cnlGatewayPlaceOrderResponse"
                              connection-factory="jmsConnectionFactory"  />

<bean id="orderWorkflowProcessor" class="de.embunit.booky.warehouseservice.integration.WorkflowProcessor">
    <property name="jsonObjectMapper" ref="jackson2JsonObjectMapper"/>
    <property name="workflowEngineBuilder" ref="orderWorkflowEngineBuilder" />
</bean>

<!--Service-->
<int:chain input-channel="cnlGatewayPlaceOrderRequestCustGranted" output-channel="cnlGatewayPlaceOrderResponse">
    <int:service-activator id="orderWorkflowProcessor" ref="orderWorkflowProcessor" method="process" />
</int:chain>

必须有可能创建一个包含不同类型的响应数据的新消息。

0 个答案:

没有答案