We currently are using 2 different URL formats in Qpid, we need to get that
sorted out and aligned with the AMQP spec.
The attached is a proposal, if we get agreement that its' good for Qpid then
I'll submit it to the AMQP working group.
All improvements welcome!
* Proposal to unify Qpid and AMQP URL addressing.
The Qpid M4 Java and C++ clients use different URL formats.
Java uses: http://cwiki.apache.org/qpid/connection-url-format.html
C++ uses the AMQP 0-10 format:
http://jira.amqp.org/confluence/download/attachments/720900/amqp.0-10.pdf?version=1
section 9.1.2
The AMQP 0-10 format only provides protocol address information for a
(list of) brokers. The Qpid M4 Java format provides additional options
for connection properties (user, password, vhost etc.)
This following proposal combines the features of both formats,
intended to be a unified format for Qpid and the basis of a proposal
to the AMQP working group.
# URL begins with list of protocol addresses like an AMQP 0-10 URL.
amqp_url = "amqp://" broker_addr [vhost]
broker_addr = addr [";" addr]*
addr = prot_addr [options]
prot_addr = tcp_prot_addr | other_prot_addr
vhost = "/" xalphas [options]
# TCP is the default protocol
tcp_prot_addr = tcp_id tcp_addr
tcp_id = "tcp:" | ""
tcp_addr = [host [":" port] ]
host = ... as per http://www.ietf.org/rfc/rfc3986.txt
port = digits
# Other protcol address formats can be specified by the standard or by
implementations.
# They must conform to this grammar:
other_prot_addr= prot_id ":" xalphas
other_prot_id = alphas
# Options can be added to individual addresses or to the vhost.
options = "?" option [ "&" option]*
option = name "=" value
name = xalphas
value = xalphas
For alphas, number, xalphas see http://www.w3.org/Addressing/URL/5_BNF.html#z57
Options can be applied to the entire vhost or to specific protocol
addresses, providing a flexible way to extend the URL syntax. The AMQP
standard will define some options, implementations may define
proprietary options. Implementations should ignore any option they do
not recognize.
TODO:
- protocol address formats and options for other transports - ssl/tsl,
infiniband, vm...
- standard options for values in the standard connection negotiation (e.g.
security mechanism)
- qpid proprietary options (e.g. JMS clientid?)
* Examples
# Connect to vhost "/" and via default AMQP port on host1. TCP is the default
protoocl.
amqp:host1
# Connect to port 1234, virtual host "vhost" passing username, password and a
JMS client-id
amqp:tcp:host1:1234/vhost?user=foo&pass=bar&clientid=baz
# Connect to the first of host1,host2,host3 that succeeds, retry each twice.
# retry property at connection level is applied to all addresses.
amqp:host1;host2;host3/?retry=2
# Connect to the first hosts that succeeds, retry host2 twice.
amqp:host1;host2?retry=2;host3
* Differences from current formats
** Differences from AMQP 0-10 format
AMQP 0-10 used "," as an address separator. This proposal uses ";" to be
consistent with
http://www.w3.org/Addressing/URL/5_BNF.html. In all other respects this
proposal is backward
compatible with AMQP 0-10.
AMQP 0-10 did not have an initial // after amqp: with the argument
that the // form is only used for URIs with hierarchical structure.
This proposal does use the more familiar amqp:// because the URL does
specify a simple hierarchy of vhosts within a broker. In the future it
seems likely that this hierarchy will be extended to address objects
within a vhost such as queues, exchanges etc.
** Differences from Qpid Java format
Addresses are at the start of the URL rather than in the "brokerlist" option.
Option format is ?foo=bar&x=y rather than ?foo='bar'&x='y'. The use of
' quotes is not common for URI query strings. See
http://en.wikipedia.org/wiki/Query_string
user, pass and clientid are options rather than having a special place at the
front of the URL.
clientid is a Qpid proprietary property and user/pass are not relevant in all
authentication schemes.
* Compatibility
Qpid M4 Java URLs requires the brokerlist option, so this is an easy
way to detect a Qpid M4 URL vs. a URL as defined here and parse
accordingly.
A parser for the above format can also parse AMQP 0-10 URLs by
relaxing the grammer as follows:
- allow amqp: as well as amqp://
- allow ',' as well as ';' as an address separator.
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]