Skip to content

Messenger with multiple AMQP nodes #35098

Closed
@melvinkoopmans

Description

@melvinkoopmans

Description
I have a RabbitMQ cluster with multiple nodes. In order to have redundancy the application needs to be able to connect to all of the nodes. As of now, Symfony Messenger does not allow you to specify more than one node. Right now we "solve" the problem by using HAProxy. It would be better if Symfony allowed you to specify all of the nodes in the DSN.

Proposal
The default AMQP extension of PHP does not allow you to specify multiple nodes (as far as I'm concerned). The library php-amqplib allows you to do this with its AMQPStreamConnection class. Like this:

$connection = AMQPStreamConnection::create_connection([
    ['host' => HOST1, 'port' => PORT, 'user' => USER, 'password' => PASS, 'vhost' => VHOST],
    ['host' => HOST2, 'port' => PORT, 'user' => USER, 'password' => PASS, 'vhost' => VHOST]
],
$options);

I propose something similar as how Symfony uses Redis Sentinel. To use Redis Sentinel you need the Predis library and you can specify your DSN as follows:

redis:?host[redis1:26379]&host[redis2:26379]&host[redis3:26379]&redis_sentinel=mymaster

Then for AMQP you would specify the DSN as follows:

amqp:?host[node1:5672]&host[node2:5672]&host[node3:5672]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions