Make queuename in JMSTemplate dynamic based on type of record

19 Views Asked by At

I am using JSMItemWriter in a spring Batch application. Is it possible to dynamically set the queue name or dynamically define a jmsTemplate at runtime instead of defining it as a bean in the code

Depending on the type of record passed to the JSMItemWriter, i would need to write to a different queue.

1

There are 1 best solutions below

0
Mahmoud Ben Hassine On

You can configure a jms writer for each queue and use a ClassifierCompositeItemWriter. This composite writer will classify items dynamically at runtime and call the delegate writer accordingly.