Comments (7)
Tested and working - many thanks guys!
from bccresquebundle.
The way Resque handles this is by creating multiple queues. Say, default
, high
, emergency
, and low
. When you start your worker(s), you can choose to dedicate workers to certain queues (such as one or two that only listen on emergency
), or to list the queues in descending order of precedence (say, five workers listening to emergency,high,default,low
). Resque will check each queue in order, and process the first job it finds, whatever queue it might be from. In your example scenario, your high
priority job would be run by the first worker to finish any other job, and no low
priority jobs would be touched until the default
queue is empty.
Hopefully that makes sense.
from bccresquebundle.
Hello @danhunsaker
Yes, that makes sense, but it means I have one more question. Based on the example code that we can find in README.md
file:
<?php
// get resque
$resque = $this->get('bcc_resque.resque');
// create your job
$job = new MyJob();
$job->args = array(
'file' => '/tmp/file',
'content' => 'hello',
);
// enqueue your job
$resque->enqueue($job);
How can I specify the queue to use? I don't see it neither on this example nor on other examples (looking for default
to find it).
Thanks for your help,
from bccresquebundle.
Is this the way?
<?php
namespace My;
use BCC\ResqueBundle\Job;
class MyJob extends Job
{
public function __construct()
{
$this->queue = 'my_queue';
}
public function run($args)
{
...
}
}
from bccresquebundle.
<?php
// get resque
$resque = $this->get('bcc_resque.resque');
// create your job
$job = new MyJob();
$job->queue = 'queue_name';
...
For your first example.
from bccresquebundle.
If you know a job will always be placed on a certain queue, you can declare that in the class definition itself, but otherwise, the above is your best bet.
from bccresquebundle.
Hi @nickdtodd and @danhunsaker
Thanks for your replies. I will try to test this.
Enjoy the rest of your day!
from bccresquebundle.
Related Issues (20)
- New Relic transaction naming support for Jobs? HOT 1
- Event for failed jobs? HOT 3
- Cleanly shutdown Supervisor? HOT 2
- Dependent Jobs HOT 4
- Warn users of potential data loss
- call on getContainer() on class that extends ContainerAwareJob gives an error HOT 1
- Removing non responsive workers HOT 3
- new stable release HOT 12
- Cannot install from composer HOT 1
- autoload.php with supervisord HOT 2
- bcc:resque:worker-run commands
- supervisor - waiting for queue HOT 3
- How to get resque log in Monolog? HOT 3
- Scheduled worker - strlen expects parameter 1 to be string HOT 2
- Event kernel.terminate is not called hence SwiftMailer spool does not work HOT 2
- Allow to set *Kernel in bundle configuration
- Workers won't run (Windows) HOT 2
- Support for Symfony 3 HOT 5
- Supervisor processes are throwing exceptions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bccresquebundle.