Triggering PHP from ActiveMQ
        Posted  
        
            by scompt.com
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by scompt.com
        
        
        
        Published on 2010-05-27T16:36:00Z
        Indexed on 
            2010/06/11
            23:03 UTC
        
        
        Read the original article
        Hit count: 446
        
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?
 - ??
 
© Stack Overflow or respective owner