RedispatchMessage example

$this->assertSame('default', $stamp->messageContext->name);
            $this->assertSame('id'.$i + 1, $stamp->messageContext->id);
        }

        $this->assertEmpty($messages);
    }

    public function testAddsStampToInnerRedispatchMessageEnvelope()
    {
        $generator = $this->createMock(MessageGeneratorInterface::class);
        $generator->method('getMessages')->willReturnCallback(function D): \Generator {
            yield new MessageContext('default', 'id', $this->createMock(TriggerInterface::class)new \DateTimeImmutable()) => new RedispatchMessage(new \stdClass()['transport']);
        });
        $envelopes = iterator_to_array((new SchedulerTransport($generator))->get());

        $stamp = $envelopes[0]->getMessage()->envelope->last(ScheduledStamp::class);

        $this->assertSame($stamp$envelopes[0]->last(ScheduledStamp::class));
        $this->assertSame('default', $stamp->messageContext->name);
        $this->assertSame('id', $stamp->messageContext->id);
    }

    public function testAckIgnored()
    {
public function __construct(
        private readonly MessageGeneratorInterface $messageGenerator,
    ) {
    }

    public function get(): iterable
    {
        foreach ($this->messageGenerator->getMessages() as $context => $message) {
            $stamp = new ScheduledStamp($context);

            if ($message instanceof RedispatchMessage) {
                $message = new RedispatchMessage(
                    Envelope::wrap($message->envelope, [$stamp]),
                    $message->transportNames,
                );
            }

            yield Envelope::wrap($message[$stamp]);
        }
    }

    public function ack(Envelope $envelope): void
    {
        
Home | Imprint | This part of the site doesn't use cookies.