On 11/03/2010 03:35 AM, Wolgemuth Greg wrote:
I'm having some trouble working with address strings in the qpid
messaging API. I've been working through the examples in the 0.7
programming guide and the documentation, but keep coming up short with
'spout' and 'drain'. Here's what I'm trying to do:
#1 Create a direct exchange (call it x)
#2 Send a message to x with a routing key (call it r)
#3 Make a queue (call it q) that binds to x, bound on key r
#4 Receive the message sent to x
The issue here is that your queue does not exist when the message is
published at step 2, so the message is dropped. Step 3 needs to happen
before step 2.
Here's what I'm doing to make it happen:
spout -b f.q.d.n "x/r ; { create: always, node: {type: topic, x-declare: {exchange:
x, type: direct, routing-key: r}}}"
drain -b f.q.d.n "q ; { create: always, node: {type: queue, x-bindings: [{exchange:
x, queue: q, key: r}]}}"
The result is that drain receives no message.
If you start drain first, and get it to wait for a message (-f is wait
forever; -t 5 would wait only for 5 seconds):
drain -b f.q.d.n "x/r; {create: always}" -f
then run spout:
spout -b f.q.d.n x/r
you should see drain getting the message.
I would personally tend to use static creation of exchanges (e.g. using
qpid-config) which makes the drain address identical to the spout address:
qpid-config add exchange topic x
drain -b f.q.d.n -f x/r
spout -b f.q.d.n x/r
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]