Question

I am a newbie at Spring Batch and have recently started using it.

I have a requirement where I need to post/write the messages read from each DB record on different queues using single Job. As I have to use reader to read the messages from DB and use processor to decide on which queue I have to post it.

So my question is Can I use single JMSwriter to post the messages on different queues as I have to use single Job and DB Reader.

Thanks in Advance

Was it helpful?

Solution

As I know JMSwriter not supports it (it writes to default destination of jmsTemplate).

But you may just implement your own ItemWriter, inject all jmsTemplates in it and write custom decistion logic to select appropriate destionation and write to it.

Another way - use ClassifierCompositeItemWriter , put a set of JmsWriters to it and select one by your classifier

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top