Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

dynamic config tMomOutput component

How to dynamically configure the tMomOutput for ActiveMQ with the "To" queue name passed in from the request.
More specifically, I have a job listen to a request using the tMomInput component. the response queue name is embedded in the request. My job will decode the response queue name, save it to a context variable "replyQueueName", then use it to configure the tMomOutput component (the value for the field "To" of the tMomOutput component is: context.replyQueueName).
This is not working, it seems the tMomOutput component is configured before the job actually starts, so it takes whatever the initial value of the context variable, not the dynamic value I assigned after decoding the request message.
Could someone tell me how to get around this?
Thanks
Labels (2)
2 Replies
Anonymous
Not applicable
Author

Hi Xiaodong,
If you have access to the ESB components, the best way to do this is with cJMS and by manipulating the header CamelJMSDestinationName header (see doc link below).
If you must use a DI job, I think you could spawn a new job (tRunJob?) and configure the context property as needed so it's effective on initialization of that job. Of course, this is not efficient. So Mediation is a much better solution. If you still want to see dynamic queue/topic resolution in tMomOutput, I suggest creating a new JIRA and mark it as a work item (link below).
http://camel.apache.org/jms.html
https://jira.talendforge.org/secure/Dashboard.jspa
Best Regards,
Ben
Jeeva
Contributor
Contributor

As the queue initialization is done before tMomOutput we have to explicitly add the following line to update the queue in case if we need to pass the message the dynamic queues. The following line has to be added one step before the to tMomOutput. The tMomOutput  To field can be set with the dummy queue name. 


javax.jms.Destination des_tMomOutput_1;
des_tMomOutput_1 = session_tMomOutput_1.createQueue("DestinationQueueName");

producer_tMomOutput_1 = session_tMomOutput_1.createProducer(des_tMomOutput_1);

 

https://community.talend.com/t5/Design-and-Development/Dynamic-destination-in-tMomOutput/m-p/210154#...