0

I have spring web/integration application. In order to run the long running processes in the background, I have used queue backed by MongoDbMessageStore and polls the queue every one second.

I tried to send the messages(1000 messages per instance) to the gateway from the same application running on two tomcat instances. I verified that messages processed by server 1, are not being processed by server 2 and vice versa. I saw the document stored in the mongo collection. It has UUID (message id) and _group_complete, but i am not able to conclude how does spring avoids duplicate message processing if the application running on multiple instances with a single momgodb instance.

Appreciate your help.

1 Answer 1

0

Because MongoDbMessageStore uses findAndRemove operation.

And that's an expected behaviour for distributed environment.

Would be worse if you'd say the opposite.

2
  • Thanks Artem for the prompt reply. So, should i not be worried about duplicate processing of the message in multiple tomcat instances? Is there any url you can share, that depicts the message processing occurs in spring integration(ensures that no duplicate message processing be it using jdbc/mongo or any store)
    – Deb
    Nov 14, 2014 at 18:05
  • Read our Manual, please. But to be honest the ACID principle is out of SI scope. It's really a responsibility of DB. So, the question "if several processes can do something with the same DB record" is for them. Right, we should use DB correctly and we try to do that in the Framewrok. As you see here it is findAndRemove to avoid duplicate from different processes. Nov 14, 2014 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.