laravel-queue-rabbitmq
laravel-queue-rabbitmq copied to clipboard
Nothing push to queue when exchange is not empty
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'),
],