qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wolgemuth Greg <woo...@eseri.com>
Subject Re: Mapping address strings to exchanges and queues
Date Wed, 03 Nov 2010 17:09:37 GMT
I'm noticing different behaviour when I'm using a "{create: always}" in
my address strings versus manually creating an exchange.

If I use the following command:

`drain -b f.q.d.n "x/r ; {create: always}" -f`

Then look at my broker using qpid-tool, I can see that no exchange "x"
has been created. When I send a message using:

`spout -f f.q.d.n "x/r"`

The message I receive is:

Message(properties={qpid.subject:r, spout-id:0623edae-6112-4077-9531-afab02cf7fed:0, x-amqp-0-10.routing-key:x},

Which isn't what I intended - the message has been routed through the 
default exchange instead of creating an exchange "x" and using it.

However, if I use the following sequence of commands:

qpid-config -a f.q.d.n add exchange direct x
drain -b f.q.d.n "x/r" -f
spout -b f.q.d.n "x/r"

Then the message I receive is:

Message(properties={qpid.subject:r, spout-id:4627536d-f8bf-4f72-ad14-aa497346be7a:0, x-amqp-0-10.routing-key:r},

And using qpid-tool shows that there is an exchange, x, on the broker 
and that the queues/bindings created by drain are using that exchange.

Is there something more I need to be doing with x-declare or x-bindings to 
get my address string to create an exchange? One of the features I'm trying 
to leverage with AMQP is the ability for any client to declare the queues and 
exchanges it needs to operate, without relying on an external bootstrapping 
or setup phase to occur first.


On Wed, 2010-11-03 at 08:48 +0000, Gordon Sim wrote:
> 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:users-subscribe@qpid.apache.org

Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org

View raw message