I am using ActiveMQ on a cluster of computers to send messages between java processes.
The cluster has a shared NFS mount accessible from all hosts.
I am running into problems with the following scenario:
- host A creates a new file "/path/to/shared/nfs/xyz"
- host A sends a message to host B: "process /path/to/shared/nfs/xyz"
- host B receives the message, attempts to open the file
- host B fails because NFS client has not yet noticed that a new file was previously created on A (race condition between ActiveMQ and the NFS protocol)
My solution is to add a loop into all message receivers that would wait up to 1 minute for the NFS to realize a new file was added.
This solution however seems unclean. What would be a good way of solving this? Do you know of any enterprise integration design patterns that apply?