STOMPing with PHP – intergration with ActiveMQ

In a previous post, “Playing with ActiveMQ using Maven”, I showed how to produce and consume simple messages using Java. In this short post I show how to access these messages from PHP using STOMP.

Assuming you are continuing from my previous article – you will need to modify your ActiveMQ configuration file to enable STOMP access. Only one additional line is required, but I include the full config below.


Restart your activeMQ (see previous post). Now we need to get the STOMP library – this is available here: Here’s an example script I’ve made which monitors a queue and consumes each message as it arrives.

echo " done!n";

while (1)
  if (($msg = $conn->readFrame()) !== false)
    echo (string)$msg;

You should see the output as follows:

connecting.... done!
message-id: ID:fork-60632-1237222786629-0:0:1:1:100
destination: /queue/test
timestamp: 1237222787006
expires: 0
priority: 4

Hello World!

One thought on “STOMPing with PHP – intergration with ActiveMQ”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.