qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brent Villalobos <Brent.Villalo...@pdi.dreamworks.com>
Subject Python Client: durability?
Date Wed, 05 Mar 2008 00:31:02 GMT
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)

    # Create the exchange and queue and bind them together
    channel.exchange_declare(exchange="message_queue", type="direct", 
    channel.queue_declare(queue=queueName, exclusive=False, durable=True)
    channel.queue_bind(exchange="message_queue", queue=queueName, 

    print "Sending message to queue '%s': '%s'" % (queueName, messageText)
    message = Content(messageText)
    message["routing_key"] = routingKey
    channel.basic_publish(content=message, routing_key=routingKey, 

    reply = channel.queue_declare(queue=queueName)
    print "Number of messages in queue '%s': %d" % (queueName, 

    # Close the session before exiting so there are no open threads.

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

View raw message