RabbitMQ Transport (via AmqpOroMessageQueue Bundle)¶
The bundle registers AmqpTransportFactory.
AMQP (RabbitMQ) Transport¶
RabbitMQ provides better and faster messages delivery versus DBAL. You should prefer to use it if possible.
Options¶
The config settings for the default RabbitMQ Access Control settings (a user named guest with a default password of guest, granted full access to the / virtual host) are:
# app/config/config.yml
oro_message_queue:
transport:
default: 'amqp'
amqp:
host: 'localhost'
port: '5672'
user: 'guest'
password: 'guest'
vhost: '/'
We can also move the specified options to the parameters.yml
:
# app/config/config.yml
oro_message_queue:
transport:
default: '%message_queue_transport%'
'%message_queue_transport%': '%message_queue_transport_config%'
client: ~
# app/config/parameters.yml
message_queue_transport: 'amqp'
message_queue_transport_config: { host: 'localhost', port: '5672', user: 'guest', password: 'guest', vhost: '/' }
RabbitMQ installation¶
You need to have RabbitMQ version 3.6.* installed to use the AMQP transport. To install the RabbitMQ you should follow the download and installation manual.
After the installation please check you have all the required plugins installed and enabled.
RabbitMQ plugins¶
Required plugins¶
Plugin name | Version | Appointment |
---|---|---|
rabbitmq_del ayed_message _exchange | 20171215 | A plugin that adds delayed-messa ging (or scheduled-mes saging) to RabbitMQ. See also |
The plugin rabbitmq_delayed_message_exchange
is necessarily needed
for the proper work but it is not installed by default so you need to
download, install and enable it.
To download it use a command like
1 | wget https://dl.bintray.com/rabbitmq/community-plugins/3.6.x/rabbitmq_delayed_message_exchange/rabbitmq_delayed_message_exchange-20171215-3.6.x.zip && unzip rabbitmq_delayed_message_exchange-20171215-3.6.x.zip -d {RABBITMQ_HOME}/plugins && rm rabbitmq_delayed_message_exchange-20171215-3.6.x.zip
|
To enable it use the command
1 | rabbitmq-plugins enable --offline rabbitmq_delayed_message_exchange
|
Recommended plugins¶
Plugin name | Version | Appointment |
---|---|---|
rabbitmq_management | 3.6.* |
|
Plugins management¶
To enable plugins, use the rabbitmq-plugins
tool: rabbitmq-plugins enable plugin-name
And to disable plugins again, use: rabbitmq-plugins disable plugin-name
You can see a list of which plugins are enabled with: rabbitmq-plugins list -e
You will see something like:
1 2 3 4 5 6 7 | [e*] amqp_client 3.6.5
[e*] mochiweb 2.13.1
[E*] rabbitmq_delayed_message_exchange 20171215
[E*] rabbitmq_management 3.6.5
[e*] rabbitmq_management_agent 3.6.5
[e*] rabbitmq_web_dispatch 3.6.5
[e*] webmachine 1.10.3
|
The sign [E*]
means that the plugin was explicitly enabled i.e.
somebody enabled manually. The sign [e*]
means the plugin was
implicitly enabled i.e. enabled automatically as it was required for
some other enabled plugin.
Troubleshooting¶
The exception
1 2 | [PhpAmqpLib\Exception\AMQPRuntimeException]
Broken pipe or closed connection
|
might be caused by one of the following reasons:
- The plugin
rabbitmq_delayed_message_exchange
is missing - The RabbitMQ version is too old (older than 3.5.8)
RabbitMQ Useful Hints¶
- You can see the RabbitMQ default web interface here if the
rabbitmq_management
plugin is enabled:http://localhost:15672/
. See more details here. - You can temporary stop RabbitMQ by running the command
rabbitmqctl stop_app
. The command will stop the RabbitMQ application, leaving the Erlang node running. You can resume it with the commandrabbitmqctl start_app
. See more details here.