« Return to Thread: Stomp Problem with receiving topic

Stomp Problem with receiving topic

by Plew :: Rate this Message:

Reply to Author | View in Thread

Hi
 
i've got a problem with Stomp+PHP 5+ActiveMQ 5.2, I'm new to MQ and JMS, hope you can help me.

I want to output all messages from a subscribed topic with PHP. The problem is, only the last message wich was sent by an client to the topic is shown by the subscriber, but I want to receive also the old messages from the topic and not only the last one. Also the PHP-Script is not working, when the topic stores old messages, nothing is shown - it's only working when it's listening and the client send something new to the topic???

I tried this sheet of code for the Subscriber (for sending i used the ApacheMQ-Bin Webfrontend).

<?php
require_once("Stomp.php");
$con = new Stomp("tcp://192.0.0.101:61613");
$con->connect();
$con->subscribe("/topic/test");
$msg = $con->readFrame();
echo $msg->body."\n";
$con->ack($msg);
$con->disconnect();
?>


So what should i do, to get all the unreceived messages from the topic, which where send between last subscription an now, without polling all the time with one script and a neverending loop, i want to poll  cyclic with a script, to get one or more messages from the topic???

greetings
Stefan

 « Return to Thread: Stomp Problem with receiving topic