我正在使用带有 ActiveMQ 的 Apache Camel,并希望实现有保证的消息传递。
我一直在阅读 Camel in Action 这本书以及 Apache Camel Developer's Cookbook。
我希望这里有人可以在我的方法中为我提供建议。我不是要代码示例。
我设想的实现方式如下:
1. Message is received on an endpoint
2. I inspect the message
3. I use the Wiretap pattern to drop it immediately on my "GuaranteedMessages" queue if the message asks for guaranteed delivery
4. I route the message to its proper destination
5. If no exceptions were encountered, I remove the message manually from the "GuaranteedMessages" queue
听起来很容易。但是,我一直在阅读 Camel 中的“死信通道”模式。
我的理解是使用这种模式的实现意味着不是自动将每个(保证的)消息放到我的“GuaranteedMessages”队列中,而是放弃这种方法,而是设置重新传递选项(最大尝试、指数延迟、重新传递延迟等) . 然后,我依靠 Camel 尝试重新交付,如果它永远无法通过,我只需将其放入死信通道延迟中即可。
然后,我将有一个单独的路由,使用这个死信队列作为它的源。同样,这将是相同的模式。如果无法成功,则将消息发送回死信队列。
这听起来像是生产系统的现实实现吗?
相反,如果我决定将每条传入消息(需要保证)放在我自己的“GuaranteeMessage”队列中,那么相信我以后可以手动从队列中删除该特定消息是否现实?我的理解是我必须手动浏览队列,遍历任意数量的消息,然后手动使用该消息。我不确定这种架构的可扩展性到底有多大。