gpt4 book ai didi

java - Spring 集成声明检查模式 - 失败时重新发送

转载 作者:行者123 更新时间:2023-11-30 07:00:12 24 4
gpt4 key购买 nike

所以,我的设置是:

<int-amqp:inbound-channel-adapter channel="input-channel" queue-names="probni" message-converter="jsonMessageConverter"
channel-transacted="true"
transaction-manager="dataSourceTransactionManager"/>
<int:chain input-channel="input-channel" output-channel="oc2">
<int:service-activator ref="h1" method="handle" />
<int:service-activator ref="h2" method="handle" />
<int:service-activator ref="h3" method="handle" />
<int:splitter />
<int:claim-check-in message-store="messageStore" />
</int:chain>


<int:channel id="oc2">
<int:dispatcher task-executor="taskExecutor" />
</int:channel>

<int:channel id="oc3" />

<int:claim-check-out message-store="messageStore" input-channel="oc2" output-channel="oc3" auto-startup="true" remove-message="true" />

<int-amqp:outbound-channel-adapter exchange-name="someexc" channel="oc3" amqp-template="rabbitTemplate" />

我希望能够在与 int-amqp:inbound-channel-adapter 相同的事务中将消息存储到 messageStore,然后有单独的线程实际将此消息发送到其他 amqp 交换。另外,如果第一个线程将消息保存在 messageStore 中,然后整个进程被终止,在这种情况下,重新启动时声明 checkout 应该知道它需要加载未发送的消息并将其发送到 oc3 channel 。

还有一件事 - 如果我有多个 claim checkin / checkout 工作人员共享同一个数据库表,他们如何知道哪条消息属于哪个 claim checkout 工作人员(当我们有来自不同的多个消息时尤其重要)组件启动时声明 checkin )?

谢谢!

最佳答案

首先让我们再看一次 Claim-Check 描述:

In the above configuration the Message that is received on the input-channel will be persisted to the Message Store identified with the message-store attribute and indexed with generated ID. That ID is the Claim Check for that Message. The Claim Check will also become the payload of the new (transformed) Message that will be sent to the output-channel.

因此,在 Claim-Check-In 中进行转换后,我们有一个 id用于存储的消息,并由 Claim-Check-Out 用于恢复存储的消息。

您可以使用QueueChannel而不是具有持久性 MessageStore 的执行器为了这个目的。

这是一个想法。

另一个就像真正的民意调查 INT_MESSAGE通过常规表 <int-jdbc:inbound-channel-adapter>对于MESSAGE_ID列并将结果发送至<claim-check-out> .

关于java - Spring 集成声明检查模式 - 失败时重新发送,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41061636/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com