使用 AMQP 在没有 MessageStore 的情况下在 Spring Integration Aggregator 中实现消息持久化? [英] Message persistence in Spring Integration Aggregator without MessageStore by using AMQP?

查看:38
本文介绍了使用 AMQP 在没有 MessageStore 的情况下在 Spring Integration Aggregator 中实现消息持久化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道当我使用没有 MessageStore 支持的聚合器时,我是否可以通过利用聚合器前后的 AMQP (RabbitMQ) 队列的持久性在我的 Spring Integration 设置中实现持久性.我想这将使用 ack's: 聚合器在收集所有部分并发送结果消息之前不会确认消息.另外我想知道这是否是一个好主意:)

I would like to know if I can have persistence in my Spring Integration setup when I use a aggregator, which is not backed by a MessageStore, by leveraging the persistence of AMQP (RabbitMQ) queues before and after the aggregator. I imagine that this would use ack's: The aggregator won't ack a message before it's collected all the parts and sent out the resulting message. Additionally I would like to know if this is ever a good idea :)

我是队列的新手,我正在尝试对使用的模式有一个很好的感觉.

I am new working with queue's, and am trying to get a good feel for patterns to use.

我的业务逻辑如下:

  • 我在一个队列中收到一条消息.
  • 每条消息必须导致两个不相关的网络服务调用(最好是并行调用).
  • 这两次调用的结果必须与原始消息中的详细信息相结合.
  • 然后必须将该组合作为队列中的新消息发送出去.

信息很重要,所以不能丢失.

Messages are important, so they must not be lost.

我曾经/现在希望只使用一个持久"系统,即 RabbitMQ,而不必添加数据库.

I was/am hoping to use only one 'persistent' system, namely RabbitMQ, and not having to add a database as well.

我试图保持问题的具体性,但非常感谢有关如何解决此问题的任何其他建议:)

I've tried to keep the question specific, but any other suggestions on how to approach this are greatly appreciated :)

推荐答案

你想做什么让我想起 Scatter-Gather EI 模式.

What you would like to do recalls me Scatter-Gather EI Pattern.

因此,您从 AMQP 收到一条消息,将其发送到 ScatterGather 端点并等待聚合回复.这足以坚持使用默认确认.

So, you get a message from the AMQP send it into the ScatterGather endpoint and wait for the aggregated reply. That's enough for to stick with the default acknowledge.

对了,scatterChannel 可以是 PublishSubscribeChannel 和一个 executor 并行调用 Web 服务.不管怎样,gatherer进程会根据发布策略等待回复,并且会阻塞原来的AMQP监听器,不要过早确认消息.

Right, the scatterChannel can be PublishSubscribeChannel with an executor to call Web Services in parallel. Anyway the gatherer process will wait for replies according the release strategy and will block the original AMQP listener do not ack the message prematurely.

这篇关于使用 AMQP 在没有 MessageStore 的情况下在 Spring Integration Aggregator 中实现消息持久化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆