qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gordon Sim <g...@redhat.com>
Subject Re: Binding declaration in C++ messaging client
Date Mon, 04 Jul 2011 12:34:49 GMT
On 07/04/2011 01:23 PM, Jiri Krutil wrote:
>>> Using the C++ messaging client, I would like to declare a binding from
>>> exchange E to queue Q without declaring the exchange or the queue;
>>> assuming both already exist. (I want to avoid their declaration because
>>> I don't know all their attributes, so in case they don't exist, I want
>>> to get an error.)
>>> Is this perhaps possible by creating a Sender to an exchange that always
>>> exists (say amq.direct) and specifying my binding between E and Q in the
>>> Address (in the x-bindings list under node)?
>> Yes, but the x-bindings should then appear in the link, not the node.
>> The node bindings are evaluated only if the node needs to be created.
>> The link bindings are evaluated whenever a 'link' to or from the node,
>> i.e. a sender or receiver, is created.
>> E.g. Assuming an exchange my-exchange and queue my-queue (which were
>> separately configured or pre-exist), I can create a sender to:
>>     my-exchange/my-key; {link:{x-bindings:[{exchange:my-exchange,
>> queue:my-queue, key:my-key}]}}
>> which on creation will result in the binding being created. Note however
>> that the binding will be destroyed when the sender is closed.
> I simply need to bind a queue to an exchange and I need the binding to
> stay there even if I disconnect. I don't want to declare the queue or
> the exchange or send or receive any messages.
> Can I do this using the C++ messaging client?

Yes, providing you are using an 0.10 broker you can send it an explicit 
bind message.

Send a map message to 'qmf.default.direct/broker'. The map must have 
three entries:

The first entry has key '_object_id' whose value is a nested map which 
contains a single entry with key '_object_name' and value 

The second entry has key '_method_name' and the value should in this 
case be 'create'.

The third entry has key '_arguments' and the value should be a nested 
map in which the named arguments for the command are contained. The 
required arguments in this case are: (i) 'type' = 'binding' and (ii) 
'name' = <exchange-name>/<queue-name>/<binding-key> (e.g. 
name=amq.direct/my-queue/my-subject). You can specify any additional 
arguments for the binding as well.

In addition to correctly formatted content, there are two message
properties that must also be set. These are 'x-amqp-0-10.app-id',
which should always have the value 'qmf2' and 'qmf.opcode' which for
commands should always have the value '_method_request'.

You can set a reply to address on the message and a response will be 
sent back on creation of the binding.

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

View raw message