構建在TCP網關上的My Spring Integration應用程序運行良好。它將請求消息發送到TCP網關,並將消息轉發到serviceActivator以準備響應,並將響應發送到客戶端。在TCP網關發送響應後,在Spring集成中發送消息到serviceActivator
我想將消息發送到客戶端後保存到數據庫。我只是想知道在將響應發送到客戶端後是否可以將消息轉發到另一個serviceActivator。
如果是,應如何設置彈簧配置? 我希望在這方面提供任何幫助。
這裏是Spring上下文文件:
<beans>
<int-ip:tcp-connection-factory id="crLfServer"
type="server"
port="${availableServerSocket}"
single-use="true"
so-timeout="10000"
using-nio="false"
serializer="connectionSerializeDeserialize"
deserializer="connectionSerializeDeserialize"
/>
<bean id="connectionSerializeDeserialize" class="org.springframework.integration.ip.tcp.serializer.ByteArrayStxEtxSerializer"/>
<int-ip:tcp-inbound-gateway id="gatewayCrLf"
connection-factory="crLfServer"
request-channel="serverBytes2StringChannel"
error-channel="errorChannel"
reply-timeout="10000"/> <!-- reply-timeout works on inbound-gateway -->
<int:channel id="toSA" />
<int:service-activator input-channel="toSA"
ref="myService"
method="prepare"/>
<int:object-to-string-transformer id="serverBytes2String"
input-channel="serverBytes2StringChannel"
output-channel="toSA"/>
<int:transformer id="errorHandler"
input-channel="errorChannel"
expression="payload.failedMessage.payload + ':' + payload.cause.message"/>
</beans>
謝謝
您可以在橋上(在入站網關上連同'output-channel'是'reply-channel')和'order =「2」'在jdbc適配器上放置'order =並且回覆將首先發送。 –