Skip to content

Instantly share code, notes, and snippets.

@wazum
Created July 30, 2022 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wazum/01aa31453d54bef39aff6d737cd95007 to your computer and use it in GitHub Desktop.
Save wazum/01aa31453d54bef39aff6d737cd95007 to your computer and use it in GitHub Desktop.
Symfony Handle Message Middleware AckStamp
<?php
/** @var AckStamp $ackStamp */
if ($batchHandler && $ackStamp = $envelope->last(AckStamp::class)) {
$ack = new Acknowledger(get_debug_type($batchHandler), static function (\Throwable $e = null, $result = null) use ($envelope, $ackStamp, $handlerDescriptor) {
if (null !== $e) {
$e = new HandlerFailedException($envelope, [$e]);
} else {
$envelope = $envelope->with(HandledStamp::fromDescriptor($handlerDescriptor, $result));
}
$ackStamp->ack($envelope, $e);
});
$result = $handler($message, $ack);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment