On 01/26/2011 06:57 AM, [email protected] wrote:
Hi there,

I'm using qpid 0.6 and AMQP 0.10. Not so far ago we decided to migrate to
the latest version of qpid, which currently is 0.8.
I have looked through the AMQP 1.0 specification and discovered that it's
completely different from the previous one.
I wonder what is the analog of the exchanges and queues in the new version
of specification?

The 1.0 specification is more general in the internal broker model it assumes. The same sorts of messaging patterns will be possible[1]. Brokers may chose to implement those patterns using the exchange-queue-binding model. Other brokers may map their pre-existing models to the protocol more easily as well.

The 1.0 specification is concerned with message flow between processes and does not mandate or constrain specific mechanisms an intermediary such as a broker may offer for directing the flow of messages internal to that process.

In the AMQP 0.10 I was able to create a direct exchange and multiple
bindings between it and queues. So a single message can be send to that
exchange and it will be delivered to all the bound queues. Moreover I was
able to use the same binding key to bind multiple queues to a direct
exchange.

How to emulate such a behavior by means of the address string grammar as
described here
http://qpid.apache.org/books/0.8/Programming-In-Apache-Qpid/html/ch02s04.html#section-address-string-bnf
, without any specific definitions from the previous version of the
specification (I mean without exchanges, queues, binding and routing
keys)?

You can create a queue bound to a direct exchange and receive messages from it by using an address of the form <exchange-name>/<binding-key>.

E.g. a receiver created for amq.direct/my-subject will receive any message sent by some other API to the amq.direct exchange with routing key my-subject. [2]

This means it will receive all messages sent by a sender created for the same address (or indeed a sender created for any address with amq.direct as the name where the subject of the message is explicitly set to my-subject).

You can create multiple receivers like this and each one will receive all the relevant messages sent to that exchange. The creation of the subscription queue is handled by the library. If needed you can customise that through the link properties.

If you want to have a single receiver that can receive messages through a direct exchange with more than one subject, then at present you need to use the x-bindings element in the link properties. E.g.

amq.direct; {link: {x-bindings:[{key:abc, key:def}]}}

That is admittedly a little uglier and we want to evolve the addressing syntax to support a neater way for expressing more complex filters that a single subject or subject pattern.

While addresses of the simple form name/subject will work over AMQP 1.0 when that is available, the address options starting with x- are all somewhat protocol specific. They are temporary solutions as the addressing evolves to cover richer cases in a protocol version neutral manner. However by keeping those details in a single string it makes the programs easier to modify.

[In all the above examples you can of course create a direct exchange other than amq.direct and substitute that name].

--Gordon

[1] e.g. see the interoperability tests for the 1.0 protocol: http://www.amqp.org/confluence/display/AMQP/1-0+Testing+Suite

[2] the spout and drain examples are useful for quickly experimenting with addresses.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to