You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Wolgemuth Greg <wo...@eseri.com> on 2010/11/02 22:32:31 UTC

Permissible characters in exchange names?

Just encountered an incongruity when working with the QPID messaging API
in Python. Using the C++ example "drain" program, I can easily declare
an exchange with an address string like so:

"my.exchange/subject ; { create: always, node: {type: topic, x-declare: {exchange: my.exchange, type: direct}}}"

When I try the same thing with the Python API, I get an error message
from the parser claiming it expected a comma or right-bracket - claiming
the "." in "my.exchange" as the problematic character.

When I looked at the AMQP 0-10 specification, it seemed to state that an
exchange name could be "any combination of digits, letters and
underscores" Which is, of course violated by exchanges like "amq.topic"
but I suppose that's ignored because there's no command message required
to generate those, so it's not against the rules.

Am I correct in assuming that there's a bug in the C++ implementation
(which is too permissive and allows forbidden characters), and change my
exchange names to match the "[A-Za-z0-9_]+" regex?

Greg


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


Re: Permissible characters in exchange names?

Posted by Gordon Sim <gs...@redhat.com>.
On 11/02/2010 09:32 PM, Wolgemuth Greg wrote:
> Just encountered an incongruity when working with the QPID messaging API
> in Python. Using the C++ example "drain" program, I can easily declare
> an exchange with an address string like so:
>
> "my.exchange/subject ; { create: always, node: {type: topic, x-declare: {exchange: my.exchange, type: direct}}}"
>
> When I try the same thing with the Python API, I get an error message
> from the parser claiming it expected a comma or right-bracket - claiming
> the "." in "my.exchange" as the problematic character.

You can fix that error by quoting the exchange name:

"my.exchange/subject ; { create: always, node: {type: topic, x-declare: 
{exchange: 'my.exchange', type: direct}}}"

> When I looked at the AMQP 0-10 specification, it seemed to state that an
> exchange name could be "any combination of digits, letters and
> underscores" Which is, of course violated by exchanges like "amq.topic"
> but I suppose that's ignored because there's no command message required
> to generate those, so it's not against the rules.
>
> Am I correct in assuming that there's a bug in the C++ implementation
> (which is too permissive and allows forbidden characters), and change my
> exchange names to match the "[A-Za-z0-9_]+" regex?

The c++ broker does not enforce the domain restrictions for exchange 
name. It prevents using names that begin with 'amq.' (as per the 
'reserved-names' exception), but other than that it allows you to use 
any characters you like.

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