[rabbitmq-discuss] Last value cache for pub/sub pattern
Bill Soudan
bill at soudan.net
Fri Nov 7 16:08:33 GMT 2008
Hi all,
I see in the FAQ that support for a last value cache is planned:
http://www.rabbitmq.com/faq.html#last-message-on-topic
I'd like to use AMQP and I need this feature, so I'm going to take a crack at implementing it.
I do have one question though: isn't there a race with the described implementation? It seems possible to me that a new message may arrive from the bound exchange before the 'last-value' cache service responds with the most recent value. Yes, I could fix this with some some of timestamp value or sequence value, but I would rather not push that responsibility onto the client.
Another idea: provide a new exchange type, 'x-rabbitmq.last-value-topic', which would store the most recent message published for each topic in an Mnesia table. During exchange.bind, the value in the cache would be retrieved and delivered to the queue immediately. If no cached value was present, a special 'no value' message would be delivered instead. Thoughts? I am relatively new to both AMQP and RabbitMQ, so I'd appreciate any guidance here.
Thanks,
Bill
More information about the rabbitmq-discuss
mailing list