Srikant Mantha,

Here is an example of filtering on a jms topic: 
https://camel.apache.org/components/4.0.x/jms-component.html#_receiving_from_jms

-----Original Message-----
From: Ivan Kulaga <kulagaivanandreev...@gmail.com> 
Sent: Sunday, January 14, 2024 10:29 PM
To: users@camel.apache.org
Subject: [EXTERNAL SENDER:] Re: How will Camel filter headers in message body 
read from IBM MQ and process the transaction.

Hello! I am not from the Camel team but maybe I might be able to help.
Do I understand correctly that you need to consume only messages that have a 
specific header value? In that case you want to use jms selector, like in the 
example here:
https://urldefense.com/v3/__https://camel.apache.org/components/4.0.x/eips/selective-consumer.html__;!!KXVvCTA!MRGjoMTLFgwhrxfoTzQlYW0lDwX0JbT3DdvrgBP8n-AZOz-lH3c27O8pVPI2kdPoWhNknktMe38eYOlDjx0QzWgbha4$
Hovewer, afaik, the jms selector only work with jms properties values, so you 
will need to have your ENV value in jms property and not in the message body.

On Mon, Jan 15, 2024 at 3:44 AM Srikant Mantha <mantha.srik...@outlook.com>
wrote:

> Hi Team,
> I am reading messages from IBM MQ and using Camel JMS component. This 
> process is happening successfully so far. The below route for reference:
>
> From(mq:queue:myQueueName)
> .process(myProcessor)
>
> This application will be deployed in more than 2 environments, but the 
> IBM queue connections are same. When this happens, the application 
> will try to read the same payload from the IBM MQ queue.
> I would like to process the message based on a header attribute and 
> skip when it’s not applicable.
> Refer the header text with XML payload that is currently coming as 
> part of the camel body.
>
> This will be for env1
>
> ###<UUID>#ENV1
> <Orders id=1>
>   <Order1>
>   </Order1>
>   <Order2>
>   </Order2>
>   <Order3>
>   </Order3>
> </Orders>
>
> This will be for env2
>
> ###<UUID>#ENV2
> <Orders id=2>
>   <Order1>
>   </Order1>
>   <Order2>
>   </Order2>
>   <Order3>
>   </Order3>
> </Orders>
>
> That mean, the transaction must not be completed when it’s not 
> applicable and the payload stays in the IBM messaging queue for the 
> application running in a different env.
>
> I would like to know:
>
>   1.  How to process such scenarios in the camel route.
>   2.  Can I use camel splitter to trim the header part under the body 
> as it’s a plain text format.
>   3.  Is my message considered as consumed when I read the payload and 
> does the above processing since the order Ids may be different per 
> environment.
>   4.  Can I customize the transaction based on this logic. Is it 
> possible to configure in the route or else where ?
>
> -Regards
> Srikant Mantha
>
>
>

*************************** IMPORTANT NOTE*****************************
The opinions expressed in this message and/or any attachments are those of the 
author and not necessarily those of Brown Brothers Harriman & Co., its 
subsidiaries and affiliates ("BBH"). There is no guarantee that this message is 
either private or confidential, and it may have been altered by unauthorized 
sources without your or our knowledge. Nothing in the message is capable or 
intended to create any legally binding obligations on either party and it is 
not intended to provide legal advice. BBH accepts no responsibility for loss or 
damage from its use, including damage from virus.
******************************************************************************

Reply via email to