[GH-ISSUE #355] AmqpHandler should not enforce exchange name #120

Closed
opened 2026-03-04 02:12:20 +03:00 by kerem · 3 comments
Owner

Originally created by @jcart on GitHub (Apr 11, 2014).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/355

When creating an AmqpHandler, it's enforced in constructor to provide an exchange_name as part of configuration.

This is something that should be done outside of the scope of AmqpHandler and done as part of AmqpExchange DI configuration (via setter injection).

Enforcing this as part of AmqpHandler forces an already configured AmqpExchange to duplicate configuration which is error prone.

Originally created by @jcart on GitHub (Apr 11, 2014). Original GitHub issue: https://github.com/Seldaek/monolog/issues/355 When creating an AmqpHandler, it's enforced in constructor to provide an exchange_name as part of configuration. This is something that should be done outside of the scope of AmqpHandler and done as part of AmqpExchange DI configuration (via setter injection). Enforcing this as part of AmqpHandler forces an already configured AmqpExchange to duplicate configuration which is error prone.
kerem 2026-03-04 02:12:20 +03:00
  • closed this issue
  • added the
    Bug
    label
Author
Owner

@stof commented on GitHub (Apr 11, 2014):

this looks indeed weird

<!-- gh-comment-id:40235613 --> @stof commented on GitHub (Apr 11, 2014): this looks indeed weird
Author
Owner

@Seldaek commented on GitHub (Apr 20, 2014):

Agreed, kinda makes no sense, but I'll schedule this for 2.0 since it'd be breaking BC to remove or even ignore the argument

<!-- gh-comment-id:40897924 --> @Seldaek commented on GitHub (Apr 20, 2014): Agreed, kinda makes no sense, but I'll schedule this for 2.0 since it'd be breaking BC to remove or even ignore the argument
Author
Owner

@Seldaek commented on GitHub (May 26, 2016):

After digging into this a bit, it seems only PhpAmqpLib was actually needing/using that $exchange argument, but it seems optional at the PhpAmqpLib level. So I made it default to null and it's also not used at all anymore for the amqp extension users.

I hope this approach makes sense. Ping @postalservice14 and @nubeiro in case you have an opinion here that'd be great.

<!-- gh-comment-id:221964680 --> @Seldaek commented on GitHub (May 26, 2016): After digging into this a bit, it seems only PhpAmqpLib was actually needing/using that $exchange argument, but it seems optional at the PhpAmqpLib level. So I made it default to null and it's also not used at all anymore for the amqp extension users. I hope this approach makes sense. Ping @postalservice14 and @nubeiro in case you have an opinion here that'd be great.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/monolog#120
No description provided.