On 01/12/16 18:46, James Franco wrote:
I am trying to wrap my head around the association of topics and queues
with an exchange. Here is my understanding so far (please correct me if I
am wrong). In the end I have a question .

Point 1:
Whenever we create a queue by default it is under the default exchange
amq.direct.We can move this queue to a different direct exchange using the
bind command shown below:

./qpid-config bind NameOfDirectExchange NameOfQueue bindingKey

Now I would like to know more about topics. Whenever we create a topic we
use the command resembling the one below

./qpid-config add exchange topic news

Now the above command is basically creating an exchange of topic type.

My question is how can I create a topic without creating a new exchange  ?
Say if I wanted to create a topic under the default exchange amq.topic?

Is it possible for one exchange to have both topics and queues ? I would
think not because an exchnage can be either Direct , topic , fanout or
headers am I correct ?

In AMQP 0-10 and earlier, messages are always published to an exchange and always consumed from queues.

Exchanges have bindings associated with them. These are just rules on which queues the exchange should forward (or route) a given message to.

There are different types of exchange. The exchange type dictates what form the binding 'rules' can take. For a fanout exchange, a binding to a queue means that all messages to that exchange should go to that queue. For a direct exchange, each binding specifies a 'key' that is matched against a special property (called a routing key) of the message being routed using an exact match; messages whose routing key is exactly the same as the key of a binding are routed to the queue that binding is associated with. A topic exchange also uses a key in its bindings, but the matching allows for wildcards.

The 'topic' exchange type is (in my view) an unfortunate choice of name. You can achieve JMS style 'topic' semantics using any of the exchange types. The difference is whether you need wildcard matching or not.

A queue can be bound to more than one exchange, and there can be more than one binding between a given queue and exchange (providing these bindings differ in some way, e.g. have a different key). Binding doesn't move a queue in any way.

The 'default exchange' is really just a way to give the illusion of being able to send direct to a queue. The bindings of the default exchange are guaranteed to route a message whose routing key is the queue name to that queue (and only that queue).

Hope this helps a little. There are some better explanations of the concepts available [1][2][3]. Note though that these concepts are specific to pre 1.0 versions of the AMQP protocol.

[1] http://qpid.apache.org/releases/qpid-java-6.1.0/java-broker/book/Java-Broker-Concepts-Exchanges.html
[2] https://www.rabbitmq.com/tutorials/amqp-concepts.html
[3] https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_MRG/1.1/html/Messaging_User_Guide/chap-Messaging_User_Guide-Exchanges.html

To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org
For additional commands, e-mail: users-h...@qpid.apache.org

Reply via email to