On 12/12/2011 05:53 PM, William Henry wrote:
Hi all,
I have been very confused about the addressing and the mapping that we have
(incompletely) defined as part of the documentation. I'm told that there is no
implicit magic but there is some decision making going internally to determine
what an address means. So for example if there is a queue called 'test',
without any bindings. but I run drain and spout on test, some things
automatically happen and I get the messages.
So I was wondering what would happen if I had a queue and an exchange with the
same name?
So I tried something:
qpid-config add queue william
qpid-config add queue henry
qpid-config add exchange direct william
qpid-config add exchange direct henry
qpid-config bind william henry
qpid-config bind henry william
./drain -f -c 100 william
qpid isn't sure what to do. Fair enough!:
Ambiguous address, please specify queue or topic as node type
(But it means that someone could do something like this dynamically and cause
issues)
To some extent that is always going to be the case. I could delete and
recreate the node you are using and change the behaviour. I took the
view that it is better to be explicit about ambiguity. In general my
advice would be to avoid having queues and exchanges using the same name.
Okay so what about:
./drain -f -c 100 william/henry
Ambiguous address, please specify queue or topic as node type
How about:
./drain -f -c 100 henry/william;
Ambiguous address, please specify queue or topic as node type
Wait those aren't actually ambiguous.
They are. In both cases the named node could refer to either the
exchange or the queue. E.g. in the first case, do you want to pull
messages from the william queue or from the william exchange?
But actually they are. An address isn't really an exchange or a queue I'm
told. However we do map an address to a queue or an exchange if we feel like it
(I'm being flippant here - I mean there is some implicit mapping if it's not
ambiguous). So I can create a queue that maps to an address very conveniently
because of some convenient mapping rule that happens implicitly. How is that
happening?
It's these implicit mapping rules that are confusing. Where are these rules
defined?
Section 2.16. - The AMQP 0-10 mapping - of the Programming Guide:
http://qpid.apache.org/books/0.12/Programming-In-Apache-Qpid/html/ch02s16.html
There are also a couple of examples in the section introducing addresses
(2.4) showing that the broker entity referred to by the address
influences the messaging patterns.
Why is henry/william or william/henry ambiguous?
See above. It's because you have both a queue and an exchange of the
same name in each case.
Why don't we document this stuff better?
A combination of reasons. What makes perfect sense to the author may not
make sense to (all) readers; we need feedback that we can act on. It
takes time to improve things and that time isn't always easy to find in
busy schedules. I think there are still some structural/procedural
issues that make fixing documentation more daunting than it should be.
We certainly want to do a better job, so any suggestions & contributions
are welcome.
Why do we have examples that imply that an address maps to a queue?
An address *can* refer to a queue.
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]