On 01/26/2010 07:18 PM, Inoshiro Linden wrote:
Hello,
I have not discovered how to send persistent messages on a durable
queue using the python client and the c++ broker.
There are three issues: documentation, the python code/exception, and
the chat channel:
The documentation:
The documentation here could be improved by simply adding: "queue -
the queue name" and perhaps mentioning that "durable" is a bool (if
this is correct):
http://qpid.apache.org/docs/api/python/html/public/qpid.generator.CommandInvoker_0_10-class.html#queue_declare
The python exception and code:
I have installed the C++ broker and the client libraries, both from
the 0.5 tarballs (qpidc-0.5 and qpid-0.5). I launch the broker with:
$ qpidd --auth no --port $myport
You will also need to load a persistence module. On linux you can use
http://www.qpidcomponents.org/download.html#persistence.
Next, I have a test which uses the python client to deliver and
retrieve a message. This works (without a durable queue or a
persistent message). When I try \
enabling durability/persistence (source below), I get the following exception:
---
Traceback (most recent call last):
File "./test/durability_tests.py", line 55, in test_persistent_echo
self._send_message()
File "./test/durability_tests.py", line 67, in _send_message
self.msgbody))
File "[...]/src/qpid-0.5/python/qpid/generator.py", line 25, in<lambda>
method = lambda self, *args, **kwargs: self.invoke(inst, args, kwargs)
File "[...]/src/qpid-0.5/python/qpid/session.py", line 143, in invoke
return self.do_invoke(type, args, kwargs)
File "[...]/src/qpid-0.5/python/qpid/session.py", line 186, in do_invoke
sc.write_struct32(st)
File "[...]/src/qpid-0.5/python/qpid/codec010.py", line 255, in
write_struct32
value._type.encode_fields(sc, value)
File "[...]/src/qpid-0.5/python/qpid/spec010.py", line 256, in encode_fields
f.type.encode(codec, values[f.name])
File "[...]/src/qpid-0.5/python/qpid/spec010.py", line 164, in encode
self.type.encode(codec, value)
File "[...]/src/qpid-0.5/python/qpid/spec010.py", line 147, in encode
getattr(codec, "write_%s" % self.name)(value)
File "[...]/src/qpid-0.5/python/qpid/codec010.py", line 44, in write_uint8
return self.pack("!B", n)
File "[...]/src/qpid-0.5/python/qpid/packer.py", line 36, in pack
self.write(struct.pack(fmt, *args))
error: required argument is not an integer
delivery_mode is an integer value, you can use
session.delivery_mode.persistent for that
The changes between the working test and the test which causes that
exception are:
--- a/test/durability_tests.py Mon Jan 25 15:03:00 2010 -0800
+++ b/test/durability_tests.py Tue Jan 26 11:11:26 2010 -0800
@@ -35,7 +35,10 @@
self.qpidd = QPidDaemon()
self.session, self.close_session = self.qpidd.start_client_session()
- self.session.queue_declare(self.queuename)
+ self.session.queue_declare(queue=self.queuename, durable=True)
def tearDown(self):
self.close_session()
@@ -57,7 +60,8 @@
def _send_message(self):
self.session.message_transfer(
-
message=Message(self.session.delivery_properties(routing_key=self.queuename),
+
message=Message(self.session.delivery_properties(routing_key=self.queuename,
+
delivery_mode='persistent'),
i.e. here you want:
message=Message(self.session.delivery_properties(routing_key=self.queuename,
delivery_mode=self.session.delivery_mode.persistent),
self.session.message_properties(content_type='text/plain'),
self.msgbody))
The chat:
I've joined #qpid on freenode, but accounts there seem to be asleep.
The topic for #qpid is: "you can also find more qpid folks at
partychat0 at gmail.com on \
the qpid channel". I've googled a bit, but I am unable to add
[email protected] as a friend. Can anyone point me in the proper
direction? Also, this shou\
ld be clearly documented on this page, IMO:
http://qpid.apache.org/getting-involved.html
Any advice would be greatly appreciated.
Regards
inoshiro linden
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]