Add Queue Reference
Created by: artfulrobot
I found it hard to figure out how queues work as it was not included in the docs. Here is a single page reference which includes
- basic concepts
- links to the demoqueue extension (which I wish I'd found sooner!)
- cautions for programmers (based on painful experience!)
Merge request reports
Activity
1 # Queues Reference 2 3 CiviCRM has a system for splitting big jobs into smaller tasks on a queue, and 4 provides a couple of ways to process queues. 5 6 ## Overview 7 8 1. Create a queue object via the service provider 9 2. Create tasks (or other items) for the queue 10 3. Run the queue 11 12 There's a [demo queue](https://lab.civicrm.org/dev/core/blob/master/tools/extensions/org.civicrm.demoqueue/CRM/Demoqueue/Page/DemoQueue.php) 38 the same name as an existing queue will remove the existing queue, this 39 behaviour can be changed by passing FALSE as the `reset` parameter. 40 41 The queue *type* is translated directly into the class name, so `Sql` expects a 42 class called `CRM_Queue_Queue_Sql`. Also note that the codebase gives lots of 43 examples for type (beanstalk, immediate, interactive...), none of which are 44 implemented(!). You can have `Memory` or `Sql`. 45 46 Example: 47 48 ```php 49 $queue = CRM_Queue_Service::singleton()->create([ 50 'type' => 'Sql', 51 'name' => 'my-own-queue', 52 ]); 53 do you want me to remove all line breaks (in paras)? (grumble grumble, whole point of markdown is to maintain readability as a text file and my editor does not understand appropriate line wrapping for complex indentation...!)
Hmm... Interesting point. No don't remove the line breaks. I'll see if we can solve it with the linter.
And you've already done it :-p
If I revert it I'll fix it myself ;-)
Created by: totten
Good idea adding a chapter to the dev-docs, @artfulrobot !
Created by: seamuslee001
@artfulrobot @MikeyMJCO @totten i just happened to be playing with queues but there is actually one implementation that was missed which is what @jaapjansma actually did ages ago which is if you look at https://wiki.civicrm.org/confluence/display/CRMDOC/Howto+use+the+Queue+mechanism+in+your+extension and look at Step 7 you can see you can run a limited number of queue jobs through a cron job type mechanism
Created by: seamuslee001
@artfulrobot it seems Civirules uses it for their 'delayed' actions and added content to #675