How to post on multiple queues using single job/ JMSwriter in spring batch

谁都会走 提交于 2019-12-25 07:19:07

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/15483197/how-to-post-on-multiple-queues-using-single-job-jmswriter-in-spring-batch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!