dejanb / stomp-php

Stomp PHP Client
http://stomp.fusesource.org/documentation/php/
93 stars 46 forks source link

Why even my /topic destination prefixed with /queue/? #13

Closed paddycarman closed 12 years ago

paddycarman commented 12 years ago

Hi - I'm using ActiveMQ 5.6.0 and PHP 5.3.13. I modified the first.php code in the examples directory as follows (to print the header information as well in the message).



connect("admin", "password");
// send a message to the queue
$con->send("/topic/test", "test");
echo "Sent message with body 'test'\n";
// subscribe to the queue
$con->subscribe("/topic/test");
// receive a message from the queue
$msg = $con->readFrame();

// do what you want with the message
if ( $msg != null) {
    $h = print_r($msg->headers, true);
    print "Received message with body:".  $msg->body . "\nHeaders:" . $h . "\n";
    // mark the message as received in the queue
    $con->ack($msg);
} else {
    echo "Failed to receive a message\n";
}

// disconnect
$con->disconnect();
?>

My output is:

Sent message with body 'test'
Received message with body:test
Headers:Array
(
    [message-id] => ID:oahu2-48499-1345054969918-2:28:-1:1:1
    [JMSXUserID] =>  admin
    [destination] => /queue//topic/test
    [timestamp] => 1345057533991
    [expires] => 0
    [priority] => 4
)

Questions:

Thanks, PC

paddycarman commented 12 years ago

Not a bug. Had downloaded the code from https://github.com/dejanb/stomp-php/downloads, which apparently is not the right one. When I used the one from "Download this repository as a zip" things worked as expected. -PC