Spring集成出站通道适配器和数据库持久性

时间:2015-02-05 16:34:32

标签: spring-integration

我正在开发一个应用程序,它使用出站通道适配器将消息发布到队列。有一个新的要求是,在队列上成功发布后,消息处理过程中生成的唯一ID应该保留到数据库,而不必等待任何回复。

有人可以建议最好的方法是什么。

这就是我现有应用程序中的内容。

<int:gateway id="writerGateway" service-interface="CustomService" default-request-channel="writerChannel">
</int:gateway>

<int-jms:outbound-channel-adapter channel="writerChannel" jms-template="jmsTemplate" destination-name="${queueName}" extract-payload="true"/>

<int:channel id="writerChannel">
    <int:interceptors>
        <int:wire-tap channel="writerLogger"/>
    </int:interceptors>
</int:channel>

<int:logging-channel-adapter id="writerLogger" logger-name="writerLogger" level="INFO" expression="'Sending ' + payload?.size() + ' events'"/>

非常感谢任何帮助。

谢谢, AK

1 个答案:

答案 0 :(得分:1)

writerChannel成为<publish-subscribe-channel/>并订阅第二个流程(order="2"),例如transformer -> jdbc-outbound-channel-adapter。在jms适配器上设置order="1",如果jms发送成功,将调用第二个流。

或者,使用<recipient-list-router/>