[rabbitmq-discuss] Persisting Messages on a Direct Exchange, Selectively Looking for Particular Messages

Emile Joubert emile at rabbitmq.com
Thu Feb 16 11:01:09 GMT 2012


Hi James,

On 16/02/12 00:45, McMahon, James S (TASC) wrote:
> How would one persist messages on the directed exchange? I want to do

You can guarantee that messages are persisted by declaring queues as
durable and setting the delivery-mode to 2. The exchange plays no part
in determining whether a message will be persisted.

> My messages are directed to exchanges by a qmsgTarget field. My messages
> have a field in their structure called srcId. My messages also have a
> field in their structure called seqNum. Thus a consumer may wish to say
> "Please get me message 3 from srcid 666 from the qmsgtarget Server
> direct exchange". Another consumer may later issue the same request, so
> this third message in the sequence for srcid 666 must remain on the
> directed exchange.

Messages are stored in queues, and exchanges maintain no state. If you
need multiple consumers to receive the same message then you should
route the message to multiple queues (tutorial 3). If you need to route
messages based on headers then you will find the headers exchange useful:
http://www.rabbitmq.com/tutorials/amqp-concepts.html#exchange-headers

> I will be implementing a method deleteQmsg() that I intend to use to
> delete messages selectively.

Queues are not well suited to selective manipulation of messages beyond
the head of the queue. If the problem cannot be expressed in terms of
messaging then a relational database is more suitable for your purposes
than a message broker.



-Emile


More information about the rabbitmq-discuss mailing list