stomp-php icon indicating copy to clipboard operation
stomp-php copied to clipboard

subscribers cannot receive all message from topic

Open jiansongjay opened this issue 10 years ago • 0 comments

My stomp version is 1.0.0. ActiveMq version is 5.10.0. When I use topic model of stomp to publish and subscribe, I found that subscriber cannot receive all message from topic when the number of message over 5000. My code is shown below.

send.php require_once("Stomp.php"); $con = new Stomp("tcp://localhost:61613"); $con->connect(); $count = 0; for ($i = 0; $i < 5000; $i++) { $ret = $con->send("/topic/test_mq", "test$i"); if ($ret === true) { ++$count; } } echo 'send msg:' . $count . "\n"; $con->disconnect();

receive.php require_once("Stomp.php"); $con = new Stomp("tcp://localhost:61613"); $con->connect();

$con->subscribe("/topic/test_mq"); $count = 0; while (true) { $msg = $con->readFrame(); if ( $msg != null) { $count++; echo "Received message with body '$msg->body':$count\n"; $con->ack($msg); } else { echo "Failed to receive a message\n"; } } $con->disconnect();

Firstly, I start receive.php. Then I run the send.php. But the receive.php cannot get all the messages. It usually get over 4000, lost the rest of them. Is it a bug?

jiansongjay avatar Aug 15 '14 02:08 jiansongjay