Skip to content

[Feature] Work with multiple queue on rabbitmq:consumer command #318

Closed
@sujit-baniya

Description

@sujit-baniya
  • Lumen Version:6.3
  • Package Version: latest

When running php artisan rabbitmq:command --queue="abc,default,xyz" I'm getting following error

In AMQPChannel.php line 215:
                                                                               
  NOT_FOUND - no queue 'store-to-db-queue,store-to-db-prio-3,store-to-db-prio  
  -2,store-to-db-prio-1,store-to-db-prio-0' in vhost '/'  

As a possible solution I tried to do following:

    $queueName = explode(',', $queue);
        foreach ($queueName as $name) {
            $name = $this->mode . $name;
            $this->channel->queue_declare(
                $name,
                false,
                true,
                false,
                false,
                false
            );
            $this->channel->basic_consume(
                $name,
                '',
                false,
                false,
                false,
                false,
                function (AMQPMessage $message) use ($connection, $options, $connectionName, $name): void {
                    $this->gotJob = true;

                    $job = new RabbitMQJob(
                        $this->container,
                        $connection,
                        $message,
                        $connectionName,
                        $name
                    );

                    if ($this->supportsAsyncSignals()) {
                        $this->registerTimeoutHandler($job, $options);
                    }

                    $this->runJob($job, $connectionName, $options);
                }
            );
        }

With above change, jobs are working but when trying to Release a job or retry a job or delay a job,
I'm getting following error:

PRECONDITION_FAILED - unknown delivery tag 3

How to fix such issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions