ft420 wrote:
okie so you mean if i want to get messages on basis on its label say only
messages with HELLO label will be received else all will be discarded then
on sender side i need to set
message.getHeader().setString("Label", "HELLO");
and
on receiver side
put output of message.getHeader().getString("Label") in conditional
If you simply want to route messages based on some fixed labeling, you
can use the routing key.
E.g. on sender side published message will have the routing key set to
HELLO:
message.getDeliveryProperties().setRoutingkey("HELLO");
and on the receiver:
session.queueDeclare(arg::queue="my-queue",
arg::exclusive=true,
arg::autoDelete=true);
session.exchangeBind(arg::exchange="amq.direct",
arg::queue="my-queue",
arg::bindingKey="HELLO");
and then subscribe a listener to my-queue and you will receive any
messages published with routing-key == HELLO.
(If you want the queue to remain after the consuming client exits,
remove the exclusive and autoDelete arguments in the queue declare).
You might also like to have a look at the some of the examples for other
patterns of use.
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]