fromDescriptor example

$this->assertSame('some result', $stamp->getResult());
        $this->assertSame('FooHandler::__invoke()', $stamp->getHandlerName());

        $stamp = new HandledStamp('some result', 'FooHandler::__invoke()');

        $this->assertSame('some result', $stamp->getResult());
        $this->assertSame('FooHandler::__invoke()', $stamp->getHandlerName());
    }

    public function testFromDescriptor()
    {
        $stamp = HandledStamp::fromDescriptor(new HandlerDescriptor(new DummyCommandHandler()), 'some_result');

        $this->assertEquals(DummyCommandHandler::class.'::__invoke', $stamp->getHandlerName());
        $this->assertSame('some_result', $stamp->getResult(), 'result is forwarded to construct');
    }
}
try {
                $handler = $handlerDescriptor->getHandler();
                $batchHandler = $handlerDescriptor->getBatchHandler();

                /** @var AckStamp $ackStamp */
                if ($batchHandler && $ackStamp = $envelope->last(AckStamp::class)) {
                    $ack = new Acknowledger(get_debug_type($batchHandler)static function D\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 = $this->callHandler($handler$message$ack$envelope->last(HandlerArgumentsStamp::class));

                    if (!\is_int($result) || 0 > $result) {
                        throw new LogicException(sprintf('A handler implementing BatchHandlerInterface must return the size of the current batch as a positive integer, "%s" returned from "%s".', \is_int($result) ? $result : get_debug_type($result)get_debug_type($batchHandler)));
                    }

                    
Home | Imprint | This part of the site doesn't use cookies.