Civi::queue() - Add support for 'template' queues
authorTim Otten <totten@civicrm.org>
Fri, 3 Jun 2022 01:14:41 +0000 (18:14 -0700)
committerTim Otten <totten@civicrm.org>
Thu, 9 Jun 2022 23:17:47 +0000 (16:17 -0700)
commitb656ba019c09c4838607b1c1ec5bc941312d2671
tree0d87247237db57a9c9c870b80eb79351ba5de8ec
parent0c640db0e2c0f3a802eda17ca0246648a0dfe1d2
Civi::queue() - Add support for 'template' queues

Overview
--------

Suppose you are in the habit of making separate queue-instances for
different batches of work.  However, you want to allow the sysadmin to
configure options like `type`, `batch_limit`, and `retry_interval`.

Solution: Make a template

After
-----

```php
// Use the API to register a template, eg
\Civi\Api4\Queue::create()->setValues([
  'name' => 'template-name',
  'is_template' => TRUE,
  ...
])->execute();

// Later, create a queue from the template
$q = Civi::queue('new-queue', ['template' => 'template-name']);
```
CRM/Queue/Service.php
tests/phpunit/CRM/Queue/QueueTest.php