使用 Mule 重新排队 JMS 请求

Requeue JMS request with Mule

我将 JMS component 与 Mule 一起用于 ActiveMQ 的队列,我希望如果 请求排队失败 ,它 return到队列重试 最后一个。

我应该在 Anypoint Studio 中配置什么来做到这一点?

只是重新排队您的消息听起来不是个好主意,假设您有一条消息总是失败,这在某种意义上会导致在尝试处理消息时无休止的递归。

听起来您更感兴趣的是Rollback Exception Strategy。有了这个,您可以指定最大的重新投递次数,当超过该次数时,您可以将消息放在 DLQ(死信队列)或类似队列中,最好通知某人有关失败的消息。

You can define a rollback exception strategy to ensure that a message that throws an exception in a flow is rolled back for reprocessing. Use a rollback exception strategy when you cannot correct an error when it occurs in a flow. Usually, you use a rollback exception strategy to handle errors that occur in a flow that involve a transaction. If the transaction fails, that is, if a message throws an exception while being processed, then the rollback exception strategy rolls back the transaction in the flow. If the inbound connector is transactional, Mule delivers the message to the inbound connector of the parent flow again to reattempt processing (that is, message redelivery).