From Thursday, July, 9, 3:00 PM Pacific,
our Community site will be in
read-only mode
through Sunday, July 12th.
Thank you for your patience.

How to consume messages selectively using cJMS from ActiveMQ topic in Talend Route

Highlighted
Six Stars

How to consume messages selectively using cJMS from ActiveMQ topic in Talend Route

I'm using Talend route and the cJMS component to push and pull message from the ActiveMQ topic.

I need to retrieve the message on the basis of some property so that message can be differentiated for the multiple consumers of the topic. How and Where can I set this property so that while pulling the message from MQ I can use it?

 

I've tried the URI properties in the "advance settings" of cJMS component but still it is picking all the messages.

 

How can I achieve this? Let me know if I can provide any other information.


Accepted Solutions
Highlighted
Employee

Re: How to consume messages selectively using cJMS from ActiveMQ topic in Talend Route

Hi you need to use JMS selectors for filtering messages.
try using in advanced options
selector = header_FIELDNAME header_FIELDVALUE_using_sql_expresssion
see camel documentation for selector
http://camel.apache.org/jms.html

View solution in original post


All Replies
Highlighted
Employee

Re: How to consume messages selectively using cJMS from ActiveMQ topic in Talend Route

Hi you need to use JMS selectors for filtering messages.
try using in advanced options
selector = header_FIELDNAME header_FIELDVALUE_using_sql_expresssion
see camel documentation for selector
http://camel.apache.org/jms.html

View solution in original post

Six Stars

Re: How to consume messages selectively using cJMS from ActiveMQ topic in Talend Route

Thanks for your response rchinta_talend.

 

I'm really new to this and as per my understanding I need to add the header first and then use that header as my selector. I tried changing the flow, please check the screenshot.

Header SettingHeader SettingSelectorSelector

 

publisher cjmspublisher cjms

 

I tried understanding the documentation, but i didn't get any source to write the below expression.

 selector = header_FIELDNAME header_FIELDVALUE_using_sql_expresssion.

If it's not too much to ask, an example for the same would work for the me.

 

I'm still confused,

should I add the header and use it as selector in advance properties of consumer JMS?

or should I add the properties in advance options of publisher JMS and same properties in consumer JMS?

or should I not add the header at all?

How can I use the selector to filter?

 

Highlighted
Six Stars

Re: How to consume messages selectively using cJMS from ActiveMQ topic in Talend Route

In my publisher route I used the cSetHeader to add a header with my message ("Header", "MyHeader" ).

In my subscriber route, in the advance properties of cJMS component i added a selector like following

"selector" ,"Header = 'MyHeader'".

Using this I'm able to pick messages selectively from the Topic.

 

Thanks for your help, rchinta_talend!!

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

Talend API Designer – Technical Overview

Take a look at this technical overview video of Talend API Designer

Watch Now

Getting Started with APIs

Find out how to get started with APIs

Read