-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved recoverability and logging #373
Conversation
$retryStrategy->runCallbackWithRetries(function () use ($message) { | ||
try { | ||
$this->insertHandledMessage($message->getPayload(), $message->getHeaders()->headers()); | ||
}catch (\Exception $exception) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
retrying on failure to store in dead letter. If we will manage to store it, there is no need to nack the message in the channel
$exception | ||
); | ||
} catch (Exception) { | ||
$connection->close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we failed on rollback, it most likely means the connection is already dead, therefore we can close right away.
} | ||
if ($amqpAcknowledgementCallback->isAutoAck()) { | ||
$retryStrategy->runCallbackWithRetries(function () use ($message, $methodInvocation, $logger, $messageChannelName, $amqpAcknowledgementCallback) { | ||
$amqpAcknowledgementCallback->accept(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can try to ack with retries, under the hood connection will disconnected when acking fails.
This will help in scenarios like: dbal, redis, sqs channels, however won't help in recovering from AMQP (as same connection is needed for acking).
In case of AMQP, message will be requeued and rehandled again.
Description
This improves recoverabiility for asynchronous scenarios and logging (to provide more info what's happening with Message when it fails)