I have tried setting "delivery mode" to 2 for a Content object and also setting up my exchange and queue to "durable=True". Right now I am using the default persistence configuration (aka: "in-memory", not Berkeley DB). Perhaps I don't understand the persistence model, but it seems to me that all the qpid exchange/queue/message data would be erased when the broker quits since it was all in memory, not written to disk. Will persistence only work when I use something like Berkeley DB?

Here was my test (correct me if I'm doing something wrong):
1.  Launch the QPID Java broker
2.  Setup and bind a direct exchange and queue with durable=True.
3. Have a producer script create a Content object with the "delivery mode" property set to 2. 4. Send the message to the exchange using a "basic_publish". There is now one unconsumed message on the queue. 5. Kill the broker with a linux "kill" command to simulate some sort of system failure.
6.  Restart the broker
7. Produce another message, there should now be two messages in the queue. However, in my test I'm only seeing one message.

Martin Ritchie wrote:
On 05/03/2008, Gordon Sim <[EMAIL PROTECTED]> wrote:
Carl Trieloff wrote:
 > the store is a module that the daemon loads. For M2 which is AMQP 0-8
 > here are notes http://cwiki.apache.org/qpid/getting-started-guide.html


More specifically: http://cwiki.apache.org/qpid/3rd-party-libraries.html


 > in terms of python code fragment to set durability for 0-8 I will let
 > someone that know what the best example is comment


Something like the following will work for 0-8:

 #make the queue durable:
 channel.queue_declare(queue="myqueue", durable=True)

 #mark the published message as durable (delivery-mode=2,
 #where 2 implies durability):

 channel.basic_publish(routing_key="myqueue",
     content=Content("MyMessage", properties={'delivery_mode':2}))

IIRC on M2 the delivery mode property is 'delivery mode' note the lack of '_'.

 A durable message enqueued on a durable queue will survive even if the
 broker goes down.

 (Note, If you create exchanges other than the standard ones -
 amq.direct, amq.topic etc) you can specify durable=true to them also.
 That way the bindings to durable queues will be restored on recovery.
 The standard exchanges are all durable by default.)



Reply via email to