Skip to end of metadata
Go to start of metadata

Connectivity options for PHP Stomp client


This Stomp client supports various connectivity methods helping you achieve more flexibility in how you connect to your broker (or brokers)


The Failover transport allows you to set URIs of multiple brokers and define basic parameters of how the client should attempt to connect to those brokers (in case it fails to connect for the first time). More information on the Failover transport and how ActiveMQ implements it could be found at the following URL (

PHP Stomp client uses the same configuration syntax as ActiveMQ. So instead of connecting to the broker by using standard broker URL, such as

you can use composite URLs. For example

Now instead of trying to connect to the single broker, the client will execute reconnection logic if needed. For the previous example, if we don't have a broker connector running on port 61614 it will try to connect on port 61613. If you look at PHP , you'll find messages similar to these

Warning: fsockopen(): unable to connect to tcp://localhost:61614 (Connection refused) in /home/dejan/development/stomp/src/main/php4/Stomp.php on line 201

Warning: Could not connect to localhost:61614 (1/10) in /home/dejan/development/stomp/src/main/php4/Stomp.php on line 204

This connectivity option allows you to use this client in a clustered broker environment

Currently, you can only use the randomize parameter to specify whether you want to use random algorithm when choosing broker from the list. The client will try to connect 10 time before it fails. The more connection options will be implemented soon.


You can instruct this client to use SSL when connecting to brokers that support this feature. For example, you can add another transport connector for ActiveMQ like this

and then you can connect to it by using the following syntax for the broker URL

SSL connections can be used as a part of failover URLs. For example

  • No labels