Spring integration 在Spring集成中使用QueueChannel
我正在进行下面的案例研究Spring integration 在Spring集成中使用QueueChannel,spring-integration,Spring Integration,我正在进行下面的案例研究 创建Rest服务以接受引用id 使用引用Id从数据库获取数据(CLOB) 将数据(CLOB)放入通道(队列)以进行进一步处理 使用JSON格式的响应数据{“status”:true,“message”:“RECEIVED”}回复rest客户机 我创建了Rest服务,并使用Ref Id从数据库获取数据,但在将消息放入通道(队列)后,我无法将响应发送回Rest客户端。 Rest客户端接收到的输出为:超时内未收到回复 基本上,我希望在将数据(CLOB)推送到通道(队列)后立即
<int:channel id="responseChannel"/>
<int:channel id="initCalculation">
<int:queue/>
</int:channel>
<!-- GET -->
<int-http:inbound-gateway
request-channel="httpGetChannel"
reply-channel="responseChannel"
supported-methods="GET"
path="/init/{refId}"
payload-expression="#pathVariables.refId">
<int-http:request-mapping produces="application/json"/>
</int-http:inbound-gateway>
<int:chain input-channel="httpGetChannel" output-channel="initCalculation">
<int-jdbc:stored-proc-outbound-gateway
id="outbound-gateway-storedproc-get-forma" data-source="dataSource"
is-function="false"
stored-procedure-name="XX_EMPROC.GET_FRMA"
ignore-column-meta-data="true"
expect-single-result="true">
<int-jdbc:sql-parameter-definition name="V_REF_ID" direction="IN" />
<int-jdbc:sql-parameter-definition name="V_FRMA" direction="OUT" type="#{T(oracle.jdbc.OracleTypes).CLOB}"/>
<int-jdbc:parameter name="V_REF_ID" expression="payload" />
</int-jdbc:stored-proc-outbound-gateway>
<!- Convert to JSON Format -->
<int:service-activator ref="brInitGateway" method="getResponse"/>
</int:chain>
<int:outbound-channel-adapter channel="initCalculation" ref="brInitGateway" method="process"/>
请就上述所需的更正提出建议
谢谢看,没有人会把信息作为回复发送给
。您已经声明了responseChannel
,但谁会将其用作输出通道
我建议您这样做:
<publish-subscribe-channel id="responseChannel"/>
<int:chain input-channel="httpGetChannel" output-channel="responseChannel">
<int:bridge input-channel="responseChannel" output-channel="initCalculation"/>
此转换器没有
输出通道
,因为它将把结果发送到replyChannel
头,因此发送到
启动器。如果不发送回复,您也可以使用入站通道适配器而不是网关;默认情况下,当您将CLOB交给队列通道时,它将发送一个200OK。@GaryRussell-谢谢您的建议。我会记住的。@Artem Bilan-谢谢你的解决方案。它非常适合我的用例。
<transformer input-channel="prepareProcess" expression="' {"status": true,"message": "RECEIVED"}'"/>