qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carl Trieloff <cctriel...@redhat.com>
Subject Re: Python Client: durability?
Date Wed, 05 Mar 2008 01:55:01 GMT
Brent Villalobos wrote:
> I'm trying to figure out how to configure exchanges, queues, and 
> messages so that messages will persist even if the broker goes down.  
> I have a simple producer with the following code (this is a snippet of 
> a larger code base):
>    # Get a session and open it
>    channel = client.channel(1)
>    channel.channel_open()
>    # Create the exchange and queue and bind them together
>    channel.exchange_declare(exchange="message_queue", type="direct", 
> durable=True)
>    channel.queue_declare(queue=queueName, exclusive=False, durable=True)
>    channel.queue_bind(exchange="message_queue", queue=queueName, 
> routing_key=routingKey)
>    print "Sending message to queue '%s': '%s'" % (queueName, messageText)
>    message = Content(messageText)
>    message["routing_key"] = routingKey
>    channel.basic_publish(content=message, routing_key=routingKey, 
> exchange="message_queue")
>    reply = channel.queue_declare(queue=queueName)
>    print "Number of messages in queue '%s': %d" % (queueName, 
> reply.message_count)
>    # Close the session before exiting so there are no open threads.
>    channel.channel_close()
> I set the exchange and queue to be durable, however my message count 
> goes back to zero each time I restart the broker.  I'm using the Java 
> broker with the default config.xml file.  What am I missing?  Do I 
> need to so something special with the message to make it persistent?
> -Brent Villalobos

My guess would be that you don't have a store module loaded + the 
message also need to be market as durable.

Marking the exchange and binding as durable makes those definitions 
persistent. The messages can/need to be marked durable


View raw message