Skip to content

[10.x] Unable to work with queue #299

Closed
@codercms

Description

@codercms
  • Laravel Version: 6.x
  • Package Version: 10.1.3
  • RabbitMQ Version: 3.7.16

Describe the bug

  1. Unable to run php artisan rabbitmq:consume rabbitmq --queue=... or php artisan queue:work --queue=... commands without declaring the queue.
  2. When using php artisan rabbitmq:queue-declare command, there is no way to push any job using pushRaw method of this package, because queue-declare command declaring the queue in different way than pushRaw.

Steps To Reproduce
Try to run:

php artisan rabbitmq:consume rabbitmq --queue=some

It will result in error (PhpAmqpLib\Exception\AMQPProtocolChannelException : NOT_FOUND - no queue 'some' in vhost '/').

Let's declare the queue:

php artisan rabbitmq:queue-declare some

And run the queue worker again:

php artisan rabbitmq:consume rabbitmq --queue=some

Now it's running.

Job class:

class Some implements ShouldQueue
{
    public function fire(RabbitMQJob $job, array $payload): void
    {
        $job->release(5);  
    }
}

Trying to dispatch a job through RabbitMQ Management:

{"job": "App\\Jobs\\Some", "data": {}}

The job execution will result in error (because of "release" method):

PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-exchange' for queue 'some' in vhost '/': received the value 'some' of type 'longstr' but current is none

And after that worker falls to an infinite loop with this message: Channel connection is closed.

Trying to dispatch the same job from CLI:

Queue::pushRaw(json_encode(['job' => 'App\\Jobs\\Some', 'data' => []]), 'some');

It will result in error:

PhpAmqpLib/Exception/AMQPProtocolChannelException with message 'PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-exchange' for queue 'some' in vhost '/': received the value 'some' of type 'longstr' but current is none'

Expected behavior
Everything is works like in 9.x

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions