laravel-queue-rabbitmq icon indicating copy to clipboard operation
laravel-queue-rabbitmq copied to clipboard

Nothing push to queue when exchange is not empty

Open yeknava opened this issue 3 years ago • 0 comments

Laravel/Lumen version: 8 RabbitMQ version: 3.8.16 Package version: 11.2

Describe the bug Everything works fine when exchange is empty ('') but when i specify exchange name in queue config file nothing push to queue.

code:

PodcastProcessed::dispatch();
Queue::pushRaw(SendPodcastNotification::class, 'test3', [
   'exchange' => 'test3', 'exchange_type' => 'topic'
]);
Queue::size(); // 0  (should be 2)

$connection = new AMQPStreamConnection('rabbitmq', 5672, 'guest', 'guest');
$channel = $connection->channel();

$channel->exchange_declare('test3', 'topic', false, true, false);
$msg = new AMQPMessage(json_encode([
    'text' => 'test',
]));
$channel->basic_publish($msg, 'test3');
$channel->close();
$connection->close();

Queue::size(); // 1

config:

'rabbitmq' => [
            'queue' => 'test3',
            'connection' => PhpAmqpLib\Connection\AMQPLazyConnection::class,
            'hosts' => [
                [
                    //...
                ],
            ],
            'options' => [
                'queue' => [
                    'job' => VladimirYuldashev\LaravelQueueRabbitMQ\Queue\Jobs\RabbitMQJob::class,
                    'exchange' => 'test3',
                    'exchange_type' => 'topic',
                    'exchange_routing_key' => '',
                ],
            ],
            'worker' => env('RABBITMQ_WORKER', 'default'),
        ],

yeknava avatar May 31 '21 19:05 yeknava