Triggering PHP from ActiveMQ
- by scompt.com
Background:
Our current system involves two services (one written in Java, the other in PHP) that communicate with each other using HTTP callbacks. We would like to migrate from HTTP callbacks to a message-based architecture using ActiveMQ (or another, if necessary). We'll probably use STOMP to communicate between them. Eventually, the PHP service will be rewritten in Java, but that's not part of this project.
Question:
How can the ActiveMQ system notify PHP that a new message has been posted to the queue that the PHP system is subscribed to? In the current system, the callback inherently calls into the PHP and triggers it. This goes away with a message-based architecture.
Possible solutions:
Cron regularly calls a PHP script that checks for new messages. yuck.
A long-running PHP process that loops and sleeps and checks for new messages. less yuck?
ActiveMQ calls a PHP script when a new message is posted. good, how?
??