-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Closed
Description
Description
At the moment it does not look possible to have a custom $onHandledCallback
on the Worker
used by messenger:consume
command.
See ->
$onHandled($envelope); |
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.