Thanks for the advice on the address strings, tried it today and all worked as expected. Looking at your mechanism for undertaking bindings I am going to re-design my application any way so that I create a single receiver and apply the required bindings. Just one question, is there a qmf command I could send to get the current list of bindings?

With regard to my use case. The reason for using a single queue with multiple bindings is that the order of the messages hitting the queue is important. Basically I need to dequeue the messages from a publisher(s) in the order that they were published, by each publisher. I can intermix messages from different publishers, but if a publisher P1 sent messages A,B,C on exchange amq.topic, then my consumer needs to read the messages off in that order (A,B,C). So if a second publisher P2 sends D,E,F on amq.topic at the same time as P1 then the following dequeue order is OK A,D,E,B,C,F but B,C,D,A,F,E would not (for both P1 and P2). Its a strange use case but one I am stuck with unfortunately. I could put all the sequencing logic in the application, but I was hoping the QPID messaging semantics would save me the time and effort.

If you have any other ideas, I am open to design suggestions.

Once again thanks for the help.

On 11/06/2013 09:45, Gordon Sim wrote:
On 06/10/2013 08:35 PM, CLIVE wrote:
The application needs to dynamically create/remove bindings over time,
so I was initially creating individual receivers as I thought the
messages would get routed to the correct receiver based on the subject
key of each delivered message. Providing a list of bindings at start up
is not possible in this case.

If you want the messages to go to different receivers, is there a reason you want them to share the same queue? i.e. could you just create receivers as needed for each exchange/routing-key pair, closing them when not needed?

Thanks for the info on the link binding, that would solve my initial
problem. Would the message routing also get fixed using this address
string i.e. Receiver1 created with rxer1, receives just the rxer1
messages from the queue?

No. The x-bindings don't affect the messages selected from the queue, they just control which messages of those delivered to the exchange will be enqueued.

If you could send the detail that would be good. I can see that I will
probably re-design my implementation to use just a single receiver with
the bindings added/removed using the QMF commands. This would also
simplify my issues with the session going invalid.

The basic pattern is to send a special 'create' request map message to qmf.default.direct/broker (the broker agent). This messages should have a 'x-amqp-0-10.app-id' property set to 'qmf2' and a 'qmf.opcode' property set to '_method_request'. The content is a map of the form:

{
   _object_id : {_object_name:org.apache.qpid.broker:broker:amqp-broker},
   _method_name : create,
   _arguments : {type:binding, name:my_exchange/my_queue/my_key}
}

The name is constructed from the exchange name, the queue name and the routing key, each separated by a forward slash.

To unbind you send a very similar 'delete' message (all theat changes from the create is the value for the '_method_name' entry, which should be delete instead of create.

Attached is a little example that does something similar.



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to