prolic / HumusAmqp

PHP 7.4 AMQP library
https://humusamqp.readthedocs.io/
MIT License
76 stars 17 forks source link

Allowed different service names for exchanges #26

Closed thomasvargiu closed 8 years ago

thomasvargiu commented 8 years ago

This PR allows to bind queues with the defined exchange name property, not with the exchange key in configuration.

Actually you can define exchanges in configuration like this (note different configuration key and name):

return [
    'humus' => [
        'amqp' => [
            'exchange' => [
                'my-exchange-key' => [
                    'connection' => 'amqp.connection.default',
                    'name' => 'my-exchange',
                    'type' => 'fanout',
                ],
            ],
        ],
    ],
];

But you can't define a queue like this:

return [
    'humus' => [
        'amqp' => [
            'queue' => [
                'my-queue' => [
                    'connection' => 'amqp.connection.default',
                    'name' => 'my-queue',
                    'exchanges' => [
                        'my-exchange-key' => [],
                    ],
                ],
            ],
        ],
    ],
];

The queue factory looks for the exchange via configuration key and binds it with this key, not with the real exchange name.

This PR fix this problem.

coveralls commented 8 years ago

Coverage Status

Coverage increased (+0.009%) to 94.891% when pulling 304acb44bd69029233e5eb0739dacfbcfaee0ea2 on thomasvargiu:feature/exchange-service-name into 01228cc9524555326ef701f3de9b661441a66bfe on prolic:master.

prolic commented 8 years ago

Thanks for the PR. I need to have a closer look when I have time.

prolic commented 8 years ago

good catch!