I'm trying to get a queue from activemq using a PHP client. I included in the project a stomp library. Here is my project tree:
TestPhp/ ├―― PhpInfo.php ├―― SimpleStompConsumer.php └―― Stomp ├―― Exception | └―― StompException.php ├―― ExceptionInterface.php ├―― Frame.php ├―― Message │ ├―― Bytes.php │ └―― Map.php ├―― Message.php └―― Stomp.php and here is my code
<?php $path = "/var/www/test/TestPhp/Stomp/Stomp.php"; require_once($path); $con = new Stomp("tcp://localhost:61613"); $con->connect(); $con->subscribe("/queue/test"); $msg = $con->readFrame(); if( $msg != null) { echo "Received message with body '$msg->body'\n"; $con->ack($msg); } else { echo "Failed to receive a message\n"; } $con->disconnect(); ?> When I run the php file I get the following error and I don' know what to do. PHP Fatal error: Class 'Stomp' not found in /var/www/test/TestPhp/SimpleStompConsumer.php on line 5 PHP Stack trace: PHP 1. {main}() /var/www/test/TestPhp/SimpleStompConsumer.php:0
I'd appreciate any directives. Thanks.
Edit: Library is called Stomp. Here is the github link and the download link
Edit: Change $con = new Stomp("tcp://localhost:61613"); to $con = new FuseSource\Stomp\Stomp("tcp://localhost:61613"); $con = new FuseSource\Stomp\Stomp("tcp://localhost:61613");
ERROR returned: PHP Fatal error: Class 'FuseSource\Stomp\Exception\StompException' not found in /var/www/test/TestPhp/Stomp/Stomp.php on line 174 PHP Stack trace: PHP 1. {main}() /var/www/test/TestPhp/SimpleStompConsumer.php:0 PHP 2. FuseSource\Stomp\Stomp->connect() /var/www/test/TestPhp/SimpleStompConsumer.php:6 PHP 3. FuseSource\Stomp\Stomp->_makeConnection() /var/www/test/TestPhp/Stomp/Stomp.php:195