Message persistence in Spring Integration Aggregator without MessageStore by using AMQP?

早过忘川 提交于 2019-12-24 18:23:35

问题


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.

My business logic for this is as follows:

  • I receive a messages on one queue.
  • Each message must result in two unrelated webservice calls (preferably in parallel).
  • The results of these two calls must be combined with details from the original message.
  • The combination must then be sent out as a new message on a queue.

Messages are important, so they must not be lost.

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 :)


回答1:


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

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.

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.



来源:https://stackoverflow.com/questions/47416186/message-persistence-in-spring-integration-aggregator-without-messagestore-by-usi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!