0

We have an application which on every resource update(resource update, create, delete)creates a message and puts it on a queue. This message is picked up by a worker process, converted to a format that the receiving application (lets call it a hub) understands and sends it. The hub implements a policy of last writer wins (implemented using mongodb). Whenever the sending application fails to send a message, we enqueue it to a failed queue, which is picked up by a job and sent again in few mins. The problem here is how can we ensure consistency when we send the messages again as it might overwrite a more recent write (due to the last writer policy).

One thought was to use timestamps but there as well there is a possibility when there are multiple consumers processing the message off the queue, there as well it might result in an inconsistent state due to order and speed of processes being different.

I have been reading of multiple implementations of Lamport clock and vector clock. Can anyone suggest a better solution to handle consistency in a last writer wins policy, especially in .net.

  • @RobertHarvey - Thanks for the article. We have the projection based design except for persistence. I had two questions 1. what if the projections fail to write to persistence store, what would be the best strategy in that case. 2. When there are multiple instances creating the projections how can we ensure the order of messages? that is where i was mentioning about the timestamps. – m_d_p29 Jul 11 at 1:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.