Can we use AmqpItemReader and AmqpItermWriter for request/reply use case in spring batch?

安稳与你 提交于 2019-12-23 04:54:20

问题


I have seen the AmqpJobSample

http://docs.spring.io/spring-batch/spring-batch-samples/#AmqpJobFunctionalTests

It uses AmqpItemReader to read from rabbitmq message queue, processes it using message handler and then writes back to queue using AmqpItemWriter.

My use case is to, read items from listItemReader which I have implemented, then sends items to messaging queue which will be processed by consumers running on different servers (rabbitmq cluster) and those consumers will respond back whether the iterm are processed successfully or not for each item.

Then I will read it from message queue (in itemWriter) and if check the statuses of item processing and return the status from itemWriter if its successfull or will throw exception if it is failed.

My application is in PHP Symfony framework but I am introducing spring batch for batch process which is currently in shell script.

I am using spring batch to produce messages but my consumers are in PHP which runs on different servers. I just want to pass ids as a messages and want to process ids using PHP consumers on different servers.

How can I do remote chunking or partitioning?

http://docs.spring.io/spring-batch/reference/html/scalability.html

Are there any samples for remote chunking and partitioning using messaging e.g. RabbiyMq ?

How can I this using AmqpItemReader and AmqpItemWriter ? Do I need to use Request/Reply ? Can I set reply-to queue ? Whats the best way to do this ?


回答1:


It sounds like you should be using remote chunking instead.



来源:https://stackoverflow.com/questions/23110211/can-we-use-amqpitemreader-and-amqpitermwriter-for-request-reply-use-case-in-spri

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