I have an application that runs through various tasks as an automated process.
My client would like me to create a file in a given folder for each task as a way to flag when each task completes. They prefer this to a database flag because they can be notified by the file system rather than continually polling a database table.
I can do this but creating and deleting files as flags feels clunky. Is there a more elegant approach to notifying a third-party of an event?
0
Message queues are designed for this type of task. ZeroMQ has bindings available in a lot of different languages and a plethora of information about messaging in general. Apache has their ActiveMQ project and there’s also RabbitMQ which is using the Advanced Message Queue Protocol (AMQP).
When using a filesystem for these kind of tasks you’ll run into some various issues. If working on windows / c# the FileSystemWatcher class is known to have its fair share of issues where it simply misses the change events.
Beyond missing events I would also raise the question to the customer about reliability. If the system that is monitoring the filesystem for changes goes down how will it “catch up” when it does come back online? With a message queue these changes would be sitting in a queue (well, they don’t have to be sitting in a queue somewhere but the can be) waiting for the service to come back up and process through them. With a standard filesystem you would be left looking at the current state of the files and not knowing any of the previous changes to the flags.
MQTT might work for you. This is a very simple and lightweight publish and subscribe system. It was invented for embedded devices, but works fine in all sorts of applications.
A zillion Facebook user’s can’t be wrong, can they?
1