1

We are currently evaluating RabbitMQ. Trying to determine how best to implement some of our processes as Messaging apps instead of traditional DB store and grab. Here is the scenario. We have a department of users who perform similar tasks. As they submit work to the server applications we would like the server app to send messages back into a notification window saying what was done - to all the users, not just the one submitting the work. This is all easy to do.

The question is we would like these message to live for say 4 hours in the Queue. If a new user logs in or say a supervisor they would get all the messages from the last 4 hours delivered to their notification window. This gives them a quick way to review what has recently happened and what is going on without having to ask others, "have you talked to John?", "Did you email him is itinerary?", etc.

So, how do we publish messages that have a lifetime of x hours from the time they were published AND any new consumers that connect will get all of these messages delivered in chronological order? And preferably the messages just disappear after they have expired from the queue.

Thanks

4

3 回答 3

2

RabbitMQ 中有Per-Queue Message TTLPer-Message TTL。如果我是对的,您可以将它们用于您的任务。

于 2013-10-14T21:13:17.493 回答
0

您对消息进行排队是为了将消息从一个点传递到另一个可靠点。所以发送者可以独立于接收者工作。您建议使用临时持久存储。

一个 sql 数据库将非常适合,但 mongodb 也可以很好地工作。您在 mongo 中删除一个文档,给它一个 ttl 并让数据库处理到期。

http://docs.mongodb.org/master/tutorial/expire-data/

于 2015-09-20T17:36:45.190 回答
0

除了上述答案之外,最好让应用程序/客户端将消息发布到两个队列。消费者将从其中一个队列中消费,而另一个队列可以使用每个队列消息 TTL 或每个消息 TTL 进行配置以保留消息。

于 2015-09-20T17:29:49.683 回答