<p>Hi Michael, now I realize this scenario is not one RabbitMQ is supposed to handle out of the box, thanks for clearing it out. Nonetheless I'm afraid building support for it inside the broker is not something I can afford, therefore I think I will build something at a higher level externally, as you suggested with some collaboration from the client side.</p>
<div class="gmail_quote">On Jun 2, 2011 12:30 PM, "Michael Bridgen" <<a href="mailto:mikeb@rabbitmq.com">mikeb@rabbitmq.com</a>> wrote:<br type="attribution">>> WRT this:<br>>><br>>> /When I was writing it, I thought it would be really easy to, when a new<br>
>> queue is bound to this exchange, go fetch all the messages in that<br>>> bucket and send them to the queue.///<br>>><br>>> I’m not sure it is, that was my main question actually. How do you<br>>> figure out how to join the messages stored in the bucket and those<br>
>> arriving live so that the last message you send to the queue from those<br>>> picked up from the bucket is followed exactly by its logical successor<br>>> from those coming live?<br>>><br>>> Say I have messages 1..100 being published to the exchange, each time<br>
>> one arrives it’s stored. The exchange has received the first 50 messages<br>>> and a client performs a binding of a queue to the exchange. So you start<br>>> pulling the messages from the storage and sending them to the queue<br>
>> before forwarding any live messages. While you are pulling them out of<br>>> the storage messages 51..60 are published to the exchange, how do you<br>>> deal with them? Do you always pull from the storage? When do you stop<br>
>> pulling from the storage and relay to the queue directly what is being<br>>> published to the exchange if you don’t know whether any new messages<br>>> have arrived while you were pulling from the storage?<br>
> <br>> My inclination with this and similar use cases* is that they deserve <br>> their own content class (alongside 'exchange', 'queue', etc.).<br>> <br>> By way of illustration: the last-value-caching exchange, though it was <br>
> developed as a verification of the exchange type mechanism, is rather <br>> awkward; in the main because it is encoded in the existing AMQP <br>> operations (bind, consume), and these aren't the right vocabulary for <br>
> the intended use. See the "Limitations" section of<br>> <a href="https://github.com/squaremo/rabbitmq-lvc-plugin">https://github.com/squaremo/rabbitmq-lvc-plugin</a>.<br>> <br>> There's two natural generalisations of LVC: one is to keep an arbitrary <br>
> number of values around, and the other is to make the hold higher-order <br>> (i.e., instead of replaying values, replay some aggregate of values). <br>> Neither of these really fit in AMQP as it stands, not in the available <br>
> methods or their semantics.<br>> <br>> Anyway. So that this is helpful and not just me kicking AMQP, here is a <br>> suggestion: if the consumers are made to co-operate just slightly you <br>> can get your proxy idea to work. Just use different queues for the <br>
> replay and the live. Subscribe the live first and note the most recent <br>> message you know about at that time; then publish your saved messages <br>> through to that message into the replay queue. The consumer, when it <br>
> hears back from the proxy, drains the replay queue then starts on the <br>> live queue.<br>> <br>> <br>> Michael<br>> <br>> *I call the category "value+updates", and the synchronisation problem <br>
> you describe above is the essence of it.<br>> <br>>> _______________________________________________________________<br>>><br>>> *Simone Busoli*<br>>> Direzione risorse umane e segreteria generale – Sistemi informativi<br>
>> gestione sportiva<br>>> /Collaboratore/<br>>><br>>> *Ferrari S.p.A. * Via Ascari 55/57, 41053, Maranello (MO); Italy<br>>> *T* (+39) 0536-949.850<br>>> *E* _<a href="mailto:simone.busoli@ferrari.com">simone.busoli@ferrari.com</a> <mailto:<a href="mailto:simone.busoli@ferrari.com">simone.busoli@ferrari.com</a>>_<br>
>> _<a href="http://www.ferrari.com">www.ferrari.com</a> <<a href="http://www.ferrari.com/">http://www.ferrari.com/</a>>_<br>>><br>>> *From:* Jon Brisbin [mailto:<a href="mailto:jon@jbrisbin.com">jon@jbrisbin.com</a>]<br>
>> *Sent:* Wednesday, June 01, 2011 4:59 PM<br>>> *To:* Busoli, Simone<br>>> *Cc:* <a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>>> *Subject:* Re: [rabbitmq-discuss] How to handle full exchange history<br>
>> delivery<br>>><br>>> Maybe I wasn't being clear:<br>>><br>>> I've already written a custom exchange that stores every message it<br>>> receives in Riak (<a href="http://wiki.basho.com/">http://wiki.basho.com/</a>). I'm going to be talking about<br>
>> it next week at Erlang Factory in London, as a matter of fact. :)<br>>><br>>> <a href="https://github.com/jbrisbin/riak-exchange">https://github.com/jbrisbin/riak-exchange</a><br>>><br>>> When I was writing it, I thought it would be really easy to, when a new<br>
>> queue is bound to this exchange, go fetch all the messages in that<br>>> bucket and send them to the queue.<br>>><br>>> Since I'm using Riak, the messages themselves are not all stored in memory.<br>
>><br>>> Thanks!<br>>><br>>> Jon Brisbin<br>>> http//<a href="http://jbrisbin.com">jbrisbin.com</a><br>>><br>>> ------------------------------------------------------------------------<br>
>><br>>> *From: *"Simone Busoli" <<a href="mailto:Simone.Busoli@ferrari.com">Simone.Busoli@ferrari.com</a>><br>>> *To: *<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
>> *Sent: *Wednesday, June 1, 2011 8:43:58 AM<br>>> *Subject: *Re: [rabbitmq-discuss] How to handle full exchange<br>>> history delivery<br>>><br>>><br>>> That’s what I thought as well, although I’m thinking about a couple<br>
>> of issues about it:<br>>><br>>> · Lack of knowledge about Erlang, which is the language I’d have to<br>>> use to build a custom exchange, I guess<br>>><br>>> · Amount of memory it would require to store the entire history in<br>
>> memory. It needn’t be in memory actually, but I’m not sure what<br>>> would be the recommended way if the storage has to be carried out by<br>>> exchange itself. Mnesia perhaps, would it make sense?<br>
>><br>>> _______________________________________________________________<br>>><br>>> *Simone Busoli*<br>>> Direzione risorse umane e segreteria generale – Sistemi informativi<br>>> gestione sportiva<br>
>> /Collaboratore/<br>>><br>>> *Ferrari S.p.A. * Via Ascari 55/57, 41053, Maranello (MO); Italy<br>>> *T* (+39) 0536-949.850<br>>> *E* _<a href="mailto:simone.busoli@ferrari.com">simone.busoli@ferrari.com</a> <mailto:<a href="mailto:simone.busoli@ferrari.com">simone.busoli@ferrari.com</a>>_<br>
>> _<a href="http://www.ferrari.com">www.ferrari.com</a> <<a href="http://www.ferrari.com/">http://www.ferrari.com/</a>>_<br>>><br>>> *From:* Jon Brisbin [mailto:<a href="mailto:jon@jbrisbin.com">jon@jbrisbin.com</a>]<br>
>> *Sent:* Wednesday, June 01, 2011 3:38 PM<br>>> *To:* Busoli, Simone<br>>> *Cc:* <a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>>> *Subject:* Re: [rabbitmq-discuss] How to handle full exchange<br>
>> history delivery<br>>><br>>> I've been seriously considering adding this functionality to the<br>>> Riak-backed custom exchange. It was something I thought I would add<br>>> first time through but didn't.<br>
>><br>>> You'd have to use a custom exchange. Not sure if that's an issue in<br>>> your scenario or not.<br>>><br>>><br>>> Thanks!<br>>><br>>> Jon Brisbin<br>
>> http//<a href="http://jbrisbin.com">jbrisbin.com</a><br>>><br>>> ------------------------------------------------------------------------<br>>><br>>> *From: *"Simone Busoli" <<a href="mailto:Simone.Busoli@ferrari.com">Simone.Busoli@ferrari.com</a>><br>
>> *To: *<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>>> *Sent: *Wednesday, June 1, 2011 5:52:24 AM<br>>> *Subject: *[rabbitmq-discuss] How to handle full exchange<br>
>> history delivery<br>>><br>>> Hi,<br>>><br>>> I am trying to achieve a scenario in which messages are<br>>> published from some data source into a RabbitMQ exchange and<br>
>> clients should be able to receive the full history of messages<br>>> flown through that exchange, regardless of the exact moment in<br>>> time when they connect.<br>>><br>
>> I’ve been thinking to solve it by setting up a proxy which<br>>> subscribes to the exchange where messages are published using<br>>> its own queue, keeps an internal storage of the messages and<br>
>> accepts requests from clients.<br>>><br>>> When a request from a client arrives it just replays the full<br>>> message history to the client by publishing the messages to the<br>
>> client queue (supplied in the ReplyTo field), *then* binds the<br>>> client queue to the messages exchange, so that the client from<br>>> this moment onwards starts receiving the “live” messages, and is<br>
>> pretty much unaware of what’s happened; it simply just receives<br>>> the whole history.<br>>><br>>> Now I am under the impression that there’s a fundamental flaw in<br>>> this reasoning, since the proxy cannot know when the message<br>
>> history has completed and he can switch the client to the live<br>>> stream, because while it is replaying historical messages to the<br>>> client other live messages might be arriving on the proxy’s<br>
>> queue, thus getting into an endless loop.<br>>><br>>> I’m probably missing something obvious, any advice about how<br>>> others would approach this scenario is appreciated.<br>
>><br>>> Simone<br>>><br>>> _________________________________________________________________________________________________________________<br>>> Questo messaggio e da intendersi esclusivamente ad uso del<br>
>> destinatario e puo contenere informazioni che sono di natura<br>>> privilegiata, confidenziale<br>>> o non divulgabile secondo le leggi vigenti. Se il lettore del<br>>> presente messaggio non e il destinatario designato, o il<br>
>> dipendente/agente responsabile<br>>> per la consegna del messaggio al destinatario designato, si<br>>> informa che ogni disseminazione, distribuzione o copiatura di<br>>> questa comunicazione e<br>
>> strettamente proibita anche ai sensi del decreto legislativo<br>>> 196/03 . Se avete ricevuto questo messaggio per errore, vi<br>>> preghiamo di notificarcelo<br>>> immediatamente a mezzo e-mail di risposta e successivamente di<br>
>> procedere alla cancellazione di questa e-mail e relativi<br>>> allegati dal vostro sistema.<br>>> _________________________________________________________________________________________________________________<br>
>> This message is intended only for the use of the addressee and<br>>> may contain information that is privileged, confidential and<br>>> exempt from<br>>> disclosure under applicable law. If the reader of this message<br>
>> is not the intended recipient, or the employee or agent<br>>> responsible for delivering the<br>>> message to the intended recipient, you are hereby notified that<br>>> any dissemination, distribution or copying of this communication<br>
>> is strictly<br>>> prohibited. If you have received this e-mail in error, please<br>>> notify us immediately by return e-mail and delete this e-mail<br>>> and all attachments from<br>
>> your system.<br>>> _________________________________________________________________________________________________________________<br>>><br>>><br>>> _______________________________________________<br>
>> rabbitmq-discuss mailing list<br>>> <a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>>> <mailto:<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a>><br>
>> <a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>>><br>>> _________________________________________________________________________________________________________________<br>
>> Questo messaggio è da intendersi esclusivamente ad uso del<br>>> destinatario e può contenere informazioni che sono di natura<br>>> privilegiata, confidenziale<br>>> o non divulgabile secondo le leggi vigenti. Se il lettore del<br>
>> presente messaggio non è il destinatario designato, o il<br>>> dipendente/agente responsabile<br>>> per la consegna del messaggio al destinatario designato, si informa<br>>> che ogni disseminazione, distribuzione o copiatura di questa<br>
>> comunicazione è<br>>> strettamente proibita anche ai sensi del decreto legislativo 196/03<br>>> . Se avete ricevuto questo messaggio per errore, vi preghiamo di<br>>> notificarcelo<br>
>> immediatamente a mezzo e-mail di risposta e successivamente di<br>>> procedere alla cancellazione di questa e-mail e relativi allegati<br>>> dal vostro sistema.<br>>> _________________________________________________________________________________________________________________<br>
>> This message is intended only for the use of the addressee and may<br>>> contain information that is privileged, confidential and exempt from<br>>> disclosure under applicable law. If the reader of this message is<br>
>> not the intended recipient, or the employee or agent responsible for<br>>> delivering the<br>>> message to the intended recipient, you are hereby notified that any<br>>> dissemination, distribution or copying of this communication is<br>
>> strictly<br>>> prohibited. If you have received this e-mail in error, please notify<br>>> us immediately by return e-mail and delete this e-mail and all<br>>> attachments from<br>
>> your system.<br>>> _________________________________________________________________________________________________________________<br>>><br>>><br>>> _______________________________________________<br>
>> rabbitmq-discuss mailing list<br>>> <a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>>> <mailto:<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a>><br>
>> <a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>>><br>>> _________________________________________________________________________________________________________________<br>
>> Questo messaggio è da intendersi esclusivamente ad uso del destinatario<br>>> e può contenere informazioni che sono di natura privilegiata, confidenziale<br>>> o non divulgabile secondo le leggi vigenti. Se il lettore del presente<br>
>> messaggio non è il destinatario designato, o il dipendente/agente<br>>> responsabile<br>>> per la consegna del messaggio al destinatario designato, si informa che<br>>> ogni disseminazione, distribuzione o copiatura di questa comunicazione è<br>
>> strettamente proibita anche ai sensi del decreto legislativo 196/03 . Se<br>>> avete ricevuto questo messaggio per errore, vi preghiamo di notificarcelo<br>>> immediatamente a mezzo e-mail di risposta e successivamente di procedere<br>
>> alla cancellazione di questa e-mail e relativi allegati dal vostro sistema.<br>>> _________________________________________________________________________________________________________________<br>>> This message is intended only for the use of the addressee and may<br>
>> contain information that is privileged, confidential and exempt from<br>>> disclosure under applicable law. If the reader of this message is not<br>>> the intended recipient, or the employee or agent responsible for<br>
>> delivering the<br>>> message to the intended recipient, you are hereby notified that any<br>>> dissemination, distribution or copying of this communication is strictly<br>>> prohibited. If you have received this e-mail in error, please notify us<br>
>> immediately by return e-mail and delete this e-mail and all attachments<br>>> from<br>>> your system.<br>>> _________________________________________________________________________________________________________________<br>
>><br>>><br>>><br>>> _______________________________________________<br>>> rabbitmq-discuss mailing list<br>>> <a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
>> <a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>> <br>> _______________________________________________<br>
> rabbitmq-discuss mailing list<br>> <a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>> <a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
</div>