PHP Stomp client & ActiveMQ Market Data web demo

View: New views
1 Messages — Rating Filter:   Alert me  

PHP Stomp client & ActiveMQ Market Data web demo

by groovecoder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm still learning about ActiveMQ & Stomp, so I have a sorta n00b question ...

I've downloaded and installed ActiveMQ, and I've run the Market Data web demo program (http://www.activemq.org/site/web-samples.html). The servlet is working and I can see in the console that the messages are being sent every 2 seconds to their respective topics, and when I view the included ajax front-end, the messages display correctly.

However, when I tried writing a very simple PHP page (attached) using Hiram's modified Stomp Client which would consume a single message from one of the topics and display it, I get some flaky results. I changed the brokerURL to: "vm:(broker:(tcp://localhost:6000)?persistent=false)?marshal=false" and created the StompConnection this way: $c = new StompConnection("failover://(tcp://localhost:6000)?randomize=false");

The ::connect() method seems to work, but the result seems strange...

StompFrame Object
(
    [command] => ®ActiveMQ CacheEnabled
    [headers] => Array
        (
        )

    [body] =>
)

The ::subscribe() method is flaky. More than half the time, it gives a "Could not send stomp frame to server" from within writeFrame(). When ::subscribe() does work, and the script goes on to read a frame from the topic, it shows this for the result:

StompFrame Object
(
    [command] =>
    [headers] => Array
        (
        )

    [body] =>
)

It's probably something relatively simple that I've overlooked. Do I have to set up the servlet to send Stomp-compatible messages? Does anyone have a link to a working example of a non-PHP message producer sending to ActiveMQ, and a PHP message consumer receiving those messages?

Thanks.
-L

Test2.php