Java Sprint集成:如何在一个网关中使用2链和2并行
我正在尝试做两个服务链,然后我想要两个服务并行。为此,我在第二链服务后从transformer返回列表,并使用拆分器和路由器来拆分列表。我添加了聚合通道。在聚合通道中,我只得到并行服务的响应 PFB代码:Java Sprint集成:如何在一个网关中使用2链和2并行,java,spring,integration,Java,Spring,Integration,我正在尝试做两个服务链,然后我想要两个服务并行。为此,我在第二链服务后从transformer返回列表,并使用拆分器和路由器来拆分列表。我添加了聚合通道。在聚合通道中,我只得到并行服务的响应 PFB代码: 你能告诉我们你都试过什么吗?此外,还包括您编写的代码。请参考“更具建设性地提问”。@harshavmb我尝试过这段代码,也尝试过删除发布策略。您能告诉我们您都尝试了什么吗?此外,还包括您编写的代码。参考更具建设性的提问。@harshavmb我试过这段代码,也试过删除发布策略 <int
你能告诉我们你都试过什么吗?此外,还包括您编写的代码。请参考“更具建设性地提问”。@harshavmb我尝试过这段代码,也尝试过删除发布策略。您能告诉我们您都尝试了什么吗?此外,还包括您编写的代码。参考更具建设性的提问。@harshavmb我试过这段代码,也试过删除发布策略
<int:channel id="ResultChannel" />
<int:aggregator input-channel="AggrChannel" method="aggregate" output-channel="ResultChannel" expire-groups-upon-completion="true" release-strategy-expression="size() == 4" >
<bean class="com.si.userprofiles.transformer.Transformer" />
</int:aggregator>
<int:chain input-channel="req_1" output-channel="resp_1">
<int:header-enricher>
<int:header name="SOAPAction" value="getSOAPAction"></int:header>
<int:header name="Content-Type" value="application/xml"></int:header>
</int:header-enricher>
<int-http:outbound-gateway id="eai_1" url="${EAI.API.url}" http-method="POST" request-factory="httpComponentsClientHttpRequestFactory"
expected-response-type="java.lang.String" charset="UTF-8">
</int-http:outbound-gateway>
</int:chain>
<int:publish-subscribe-channel id="resp_1" task-executor="executor" apply-sequence="true" />
<int:bridge input-channel="resp_1" output-channel="AggrChannel" />
<int:transformer method="transform_1" input-channel="resp_1" output-channel="req_2">
<bean class="com.si.userprofiles.transformer.Transformer" />
</int:transformer>
<int:chain input-channel="req_2" output-channel="resp_2">
<int:header-enricher>
<int:header name="contentType" value="application/json"/>
<int:header name="Authorization" value="${EAI.CacheService.Authorization}"/>
</int:header-enricher>
<int-http:outbound-gateway id="eai_2" url="${EAI.API2.url}" http-method="POST" expected-response-type="java.lang.String" request-factory="httpComponentsClientHttpRequestFactory"
charset="UTF-8" reply-timeout="2000">
</int-http:outbound-gateway>
</int:chain>
<int:publish-subscribe-channel id="resp_2" task-executor="executor" apply-sequence="true" />
<int:bridge input-channel="resp_2" output-channel="AggrChannel" />
<int:transformer method="transform_2" input-channel="resp_2" output-channel="req_parallel">
<bean class="com.si.userprofiles.transformer.Transformer" />
</int:transformer>
<bean id="mq1ConnFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="transportType" value="${EAI.API3.transportType}" />
<property name="queueManager" value="${EAI.API3.queueManager}" />
<property name="hostName" value="${EAI.API3.hostName}" />
<property name="port" value="${EAI.API3.port}" />
<property name="channel" value="${EAI.API3.channel}" />
</bean>
<bean id="mq1ReqQ" class="com.ibm.mq.jms.MQQueue">
<constructor-arg value="${EAI.API3.Input.MQName}" />
</bean>
<bean id="mq1RespQ" class="com.ibm.mq.jms.MQQueue">
<constructor-arg value="${EAI.API3.Output.MQName}" />
</bean>
<bean id="mq2ConnFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="transportType" value="1" />
<property name="queueManager" value="Q manager name" />
<property name="hostName" value="ip" />
<property name="port" value="port" />
<property name="channel" value="channel name" />
</bean>
<bean id="mq2ReqQ" class="com.ibm.mq.jms.MQQueue">
<constructor-arg value="request Q name" />
</bean>
<bean id="mq2RespQ" class="com.ibm.mq.jms.MQQueue">
<constructor-arg value="Resp Q name" />
</bean>
<!-- <int:chain input-channel="req_3" output-channel="AggrChannel">
<int-jms:outbound-gateway id="eai_3" connection-factory="ConnFactory" request-destination="mq1ReqQ" reply-timeout="${EAI.API3.reply-timeout}" reply-destination="mq1RespQ">
</int-jms:outbound-gateway>
</int:chain> -->
<!-- start of parallel -->
<int:splitter id="msgSplitter" input-channel="req_parallel"
method="split" output-channel="RoutingChannel">
<bean class="com.si.fm.splitter.MessageSplitter"></bean>
</int:splitter>
<int:header-value-router input-channel="RoutingChannel"
header-name="routingHeader" > <!-- default-output-channel="AggrChannel" -->
<int:mapping value="1" channel="req_3" />
<int:mapping value="2" channel="req_4" />
</int:header-value-router>
<int:channel id="RoutingChannel" />
<int:chain input-channel="req_3" output-channel="resp_3">
<int-jms:outbound-gateway id="eai_3" connection-factory="mq1ConnFactory" request-destination="mq1ReqQ" reply-timeout="${EAI.API3.reply-timeout}" reply-destination="mq1RespQ">
</int-jms:outbound-gateway>
</int:chain>
<int:publish-subscribe-channel id="resp_3" task-executor="executor" apply-sequence="true" />
<int:bridge input-channel="resp_3" output-channel="AggrChannel" />
<int:chain input-channel="req_4" output-channel="resp_4">
<int-jms:outbound-gateway id="eai_4" connection-factory="mq2ConnFactory" request-destination="mq2ReqQ" reply-timeout="${EAI.API4.reply-timeout}" reply-destination="mq2RespQ">
</int-jms:outbound-gateway>
</int:chain>
<int:publish-subscribe-channel id="req_4" task-executor="executor" apply-sequence="true" />
<int:bridge input-channel="resp_4" output-channel="AggrChannel" />
<!-- end of parallel -->