createDelayOrRetryConnection example

public function testItDelaysTheMessage()
    {
        $delayExchange = $this->createMock(\AMQPExchange::class);
        $delayExchange->expects($this->once())
            ->method('publish')
            ->with('{}', 'delay_messages__5000_delay', \AMQP_NOPARAM, [
                'headers' => ['x-some-headers' => 'foo'],
                'delivery_mode' => 2,
                'timestamp' => time(),
            ]);
        $connection = $this->createDelayOrRetryConnection($delayExchange, self::DEFAULT_EXCHANGE_NAME, 'delay_messages__5000_delay');

        $connection->publish('{}', ['x-some-headers' => 'foo'], 5000);
    }

    public function testItRetriesTheMessage()
    {
        $delayExchange = $this->createMock(\AMQPExchange::class);
        $delayExchange->expects($this->once())
            ->method('publish')
            ->with('{}', 'delay_messages__5000_retry', \AMQP_NOPARAM);
        $connection = $this->createDelayOrRetryConnection($delayExchange, '', 'delay_messages__5000_retry');

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