On 01/06/17 17:58, Gordon Sim wrote:
On 01/06/17 16:13, mottese wrote:
Hi, I'm trying to use getReceiver, but am not getting the results I'm
expecting. For example, this is what I'm doing:
Session session = con.getSession();
Address addr("amq.topic/mySubject");
session.createReceiver(addr);
...
...
Receiver r = session.getReceiver("amq.topic/mySubject");
This is throwing a KeyError and I can't figure out why. Any help would be
appreciated.
You need to use the receivers 'name' to retrieve it via the
getReceiver() call. The name for the receiver is based on the 'name' of
the thing in the address - aka the 'node', which in your case is
amq.topic (the mySubject part is the subject).
If you have only one receiver on the session for a given node
(exchange/queue) then the receiver name will match that. If not, the
receiver name is qualified with a unique counter, e.g. amq.topic_1,
amq.topic_2 etc.
Actually, I need to qualify this a little. The above is accurate for
AMQP 0-10. For AMQP 1.0 it is similar but slightly different. The name
of the receiver is the name of the underlying AMQP 1.0 link. You can
specify this explicitly in the address (e.g. 'amq.topic/mySubject;
{link:{name:myname}}'. If you don't specify it explicitly it will be
generated for you as the node name (e.g. amq.topic) plus a UUID.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]