Skip to content

[Messenger] Custom method argument $onHandledCallback for worker with command messenger:consume #32560

Closed
@B-Galati

Description

@B-Galati

Description
At the moment it does not look possible to have a custom $onHandledCallback on the Worker used by messenger:consume command.

See ->

My use case is that I would like to reset monolog buffered handler at this very moment to send my error logs in batch to Sentry.

I thought about using WorkerMessageFailedEvent but then I would miss important logging messages such as :

  • $this->logger->error('Error thrown while handling message {class}. Dispatching for retry #{retryCount} using {delay} ms delay. Error: "{error}"', $context + ['retryCount' => $retryCount, 'delay' => $delay, 'error' => $throwable->getMessage(), 'exception' => $throwable]);
  • $this->logger->critical('Error thrown while handling message {class}. Removing from transport after {retryCount} retries. Error: "{error}"', $context + ['retryCount' => $retryCount, 'error' => $throwable->getMessage(), 'exception' => $throwable]);

Possible solution
Perhaps by replacing the callable with an interface that could be autowired in the command, not sure.

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