Skip to content

Would be nice to have ability to add listeners to event dispatcher #230

Description

@svycka

I have noticed that for example, the consume command does not add Symfony\Component\Messenger\EventListener\AddErrorDetailsStampListener and I don't see errors in failed messages would be nice if we could configure them somehow.

if ($container->has(EventDispatcherInterface::class)) {
$dispatcher = $container->get(EventDispatcherInterface::class);
} else {
$dispatcher = new EventDispatcher();
}
// Attach Retry Listeners. Retries will only be triggered when the transport config specifies it
$dispatcher->addSubscriber(new SendFailedMessageForRetryListener(
$container,
$container->get(RetryStrategyContainer::class),
$logger,
));
// Attach Failure Queue Listener. Messages will only be sent to the failure transport when one is configured
$dispatcher->addSubscriber(new SendFailedMessageToFailureTransportListener(
$container->get(FailureSendersProvider::class),
$logger,
));

for now, I can create a factory for Symfony\Component\EventDispatcher\EventDispatcherInterface this should work, but maybe something more configurable would be better.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions