php - Rabbit MQ - How can we listen if a file has just been dropped in a LAMP server
I am new to RabbitMQ and expecting suggestion from experts here. I have a lamp based server where a PHP application is running.
I have a programming situation like from a third party remote server a file with some new data will be dropped in my LAMP server in a random manner based on some calculation on the remote server.
Whenever there is a new file dropped in my LAMP server, I need to run a few functions and update my database.
I can do it using CRON in my server but I will need to run it every minute as per need and I do not think this is the best way to do it as the duration of the new file can be a minute or can be a number of days.
I heard by someone, RabbitMQ can help me with this. My expectation is to build a system where I can establish a listener which can detect a new file has been dropped and only then will trigger the PHP function to update my database.
Please help me understand how can I take advantage of RabbitMQ in this situation.
Thanks in advance. Sanny
Answer
Solution:
you can use rabbitmq for this, if the third party remote server is sending a AMQP message to your LAMP. rabbitmq does not listen to files or anything else.
the best way to solve your problem is, create a webhook in your LAMP server to process the dropped file. (if the file dropped via http post request to your LAMP)
so whenever you have new file, the webhook can handle it.