Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use "queue" Option Passed to QueueManager::push() #94

Merged
merged 1 commit into from
Apr 4, 2022

Conversation

amayer5125
Copy link
Contributor

Replaces the work done in #72.

@markstory markstory merged commit f75798b into cakephp:master Apr 4, 2022
@markstory
Copy link
Member

Thank you 👍

@amayer5125 amayer5125 deleted the push-queue-option branch February 15, 2023 15:42
@umer936
Copy link
Contributor

umer936 commented Sep 15, 2023

This doesn't seem to be working for me

I have
QueueManager::push(SddasJob::class, $message, ['queue' => 'plot']);
Why is this not working to use the queue 'plot'? I went into vendor/cakephp/queue/src/QueueManager.php , and debug $queue on line 255, which passes in that variable into new ClientMessage(...['requeueOptions' => [...'queue' => $queue]) but yet when I check the rabbit queue, I see it on 'enqueue.app.default' queue, not 'enqueue.app.plot'.
Same happened when I hardcoded $queue on that line.
I can set it in the app_local, but I want to override it for the specific Job

I ended up doing this in my SddasJob class

public function __construct ($ref_id)
{
    $plotQueue = Configure::read('Queue.default');
    $plotQueue = array_merge($plotQueue, ['queue' => 'plot']);
    QueueManager::setConfig('plot', $plotQueue);
    $this->reference_id = $ref_id;
}

It's like the setConfig() ran on the plugin load and it won't take the new queue parameter on the QueueManager::push() unless I do a setConfig() with a new config.

@amayer5125
Copy link
Contributor Author

There is discussion about this in issue #117.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants