This is more of a software architecture question.
Say I put some data in a MongoDB database and send an ActiveMQ message. The consumer of the message depends on the data being present in MongoDB, but if for scalability reasons the consumer uses a slave of the MongoDB database how can I be sure that the message will only be consumed when the data is in the replica?
I am using perl as my programming language, so I would prefer any potential solutions to be high level instead of, say, example java code.
As there’s no integration between ActiveMQ and MongoDB replication, you are limited to this:
Peek a message from the queue.
Verify that the data it needs is present on the slave.
If present, consume. Otherwise, proceed to next message.