I am sorry if I was not specific. Yes, I am asking how to get the application
headers from a message. Thanks again
ilango
Carl Trieloff wrote:
>
>
> ok, are you asking how to get the application headers from a message?
>
> what part do you need help with?
>
> Carl.
>
>
> ilango_g wrote:
>> That does not seem to help. Any suggestions for me?
>>
>> Carl Trieloff wrote:
>>
>>> ilango_g wrote:
>>>
>>>> Hi
>>>> I need to write a Listener listening in on an "source/inbound" queue.
>>>> This
>>>> listener will read the contents of the header and based on the content
>>>> of
>>>> a
>>>> specific header property, the Listener will pick up that message and
>>>> route
>>>> it a certain destination queue that matches the information in the
>>>> header.
>>>> Is there a sample available?
>>>>
>>>> thanks
>>>> ilango
>>>>
>>>>
>>> I don't see a canned example, but basically you would use the "match"
>>> exchange so bind your
>>> queues to the "amq.match" exchange.
>>>
>>> Then when you publish the messages you place the header to match based
>>> on the binding in the
>>> message application headers.
>>>
>>> Here are some code snippets to publish to a headers exchange...
>>>
>>> --- examples of bind & msg below...
>>>
>>> std::string myQueue=session.getId().str();
>>> session.queueDeclare(arg::queue=myQueue, arg::exclusive=true,
>>> arg::autoDelete=true);
>>>
>>> session.exchangeBind(arg::exchange="amq.match",
>>> arg::queue=myQueue, arg::arguments=bind);
>>>
>>> .... then where you publish the message
>>>
>>> session.messageTransfer(arg::content=message,
>>> arg::destination="amq.match", arg::arguments=msg);
>>>
>>>
>>>
>>>
>>> match all example
>>>
>>> FieldTable bind, msg;
>>> bind.setString("x-match", "all");
>>> bind.setString("foo", "FOO");
>>> bind.setInt("n", 42);
>>>
>>> then on message
>>> msg.setString("foo", "FOO");
>>> msg.setInt("n", 42);
>>>
>>>
>>> match any exmaple
>>>
>>> FieldTable bind, msg;
>>> bind.setString("x-match", "any");
>>> bind.setString("foo", "FOO");
>>> bind.setInt("n", 42);
>>>
>>> then on message
>>> msg.setString("foo", "FOO");
>>>
>>>
>>> easiest would be to take the pub/sub example and update it to use the
>>> "amq.match" exchange as above & the update the bindings and message
>>> transfer
>>> with header args
>>>
>>> shout if that does not help.
>>> Carl.
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>
>
>
--
View this message in context:
http://www.nabble.com/Header-based-routing-tp19963392p19978166.html
Sent from the Qpid Developers mailing list archive at Nabble.com.