Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't see proper error messsage #168

Open
chandra10207 opened this issue Jun 21, 2022 · 1 comment
Open

Can't see proper error messsage #168

chandra10207 opened this issue Jun 21, 2022 · 1 comment

Comments

@chandra10207
Copy link

I am using ActiveMQ on AmazonMQ as a broker.

When I try to connect, It always shows the exemption message "Unable to connect broker". I am not sure is it an issues with logins or port?

require __DIR__ . '/../vendor/autoload.php';

use Stomp\Client;
use Stomp\Network\Connection;
use Stomp\StatefulStomp;
use Stomp\Transport\Message;
use Stomp\Exception\ConnectionException;
use Stomp\Network\Observer\HeartbeatEmitter;
use Stomp\Transport\Frame;
use Stomp\Exception\StompException;
use Stomp\Stomp;

$brokerUri = '....';
$connection = new Connection($brokerUri);
$client = new Client($connection);
$client->setLogin($username, $pass);
// connect
try {
    $client->connect();
} catch (ConnectionException $e) {
    echo "Connections ERROR: \n". PHP_EOL;
    echo $e->getMessage() . PHP_EOL;;
}

Is there anything I am missing?

@whikloj
Copy link
Collaborator

whikloj commented Nov 8, 2023

I don't see anything immediately. You could try passing the brokerUrl directly to the Client constructor and avoid creating your own Connection, but that shouldn't really be a problem. I'd try to get this working with a local ActiveMQ broker and once that is working you can try Amazon again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants