Skip to content

Commit

Permalink
Queue pseudo-channels #561
Browse files Browse the repository at this point in the history
  • Loading branch information
AugustMiller committed Feb 15, 2024
1 parent 47d2d4b commit d27e8d2
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 1 deletion.
32 changes: 32 additions & 0 deletions docs/4.x/queue.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,38 @@ php craft queue/listen --verbose
```
:::

## Custom Queues

::: warning
This section discusses features that are only relevant to projects that use a [custom module](extend/module-guide.md) or [private plugin](extend/plugin-guide.md#private-plugins).
:::

You can set up additional queues via [application configuration](config/app.md), but _only jobs in the default `queue` component will be observable from the control panel_.

Each queue must be defined under a separate `id`:

```php
return [
// ...
'bootstrap' => [
'sluggishQueue',
],
'components' => [
'sluggishQueue' => [
'class' => craft\queue\Queue::class,
],
],
];
```

Craft doesn’t know about this queue, so it will never push jobs into it. Secondary queues are only practical when you have implemented a [custom job](extend/queue-jobs.md) that would otherwise interfere with the processing of your main queue. While [multiple runners](#daemon) can help avoid situations where one long-running (but not necessarily time-sensitive) job blocks many other quick (but vital) jobs, the only way to ensure tasks run in completely separate “channels” is to configure multiple queues, and push your custom job into a non-default queue.

Custom queues can be managed from the CLI using their kebab-cased component `id`:

```bash
php craft sluggish-queue/listen --verbose
```

## Troubleshooting

See the knowledge base article on [Resolving Failed Queue Jobs](kb:resolving-failed-queue-jobs) for a list of common queue problems.
Expand Down
34 changes: 33 additions & 1 deletion docs/5.x/system/queue.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ In addition to a status, jobs also have **description** and a **progress** value
By default, the queue is run automatically over [HTTP](#http). For more control, you can use Craft’s CLI via [CRON](#cron)—or even as a [daemonized service](#daemon).

::: tip
Advanced configuration of the queue (including alternate [drivers](repo:yiisoft/yii2-queue/tree/master/docs/guide#queue-drivers) and proxies) is possible via [application config](config/app.md#queue).
Advanced configuration of the queue (including alternate [drivers](repo:yiisoft/yii2-queue/tree/master/docs/guide#queue-drivers) and proxies) is possible via [application config](../reference/config/app.md#queue).
:::

### HTTP
Expand Down Expand Up @@ -237,6 +237,38 @@ php craft queue/listen --verbose
```
:::

## Custom Queues

::: warning
This section discusses features that are only relevant to projects that use a [custom module](../extend/module-guide.md) or [private plugin](../extend/plugin-guide.md#private-plugins).
:::

You can set up additional queues via [application configuration](../configure.md#application-configuration), but _only jobs in the default `queue` component will be observable from the control panel_.

Each queue must be defined under a separate `id`:

```php
return [
// ...
'bootstrap' => [
'sluggishQueue',
],
'components' => [
'sluggishQueue' => [
'class' => craft\queue\Queue::class,
],
],
];
```

Craft doesn’t know about this queue, so it will never push jobs into it. Secondary queues are only practical when you have implemented a [custom job](../extend/queue-jobs.md) that would otherwise interfere with the processing of your main queue. While [multiple runners](#daemon) can help avoid situations where one long-running (but not necessarily time-sensitive) job blocks many other quick (but vital) jobs, the only way to ensure tasks run in completely separate “channels” is to configure multiple queues, and push your custom job into a non-default queue.

Custom queues can be managed from the CLI using their kebab-cased component `id`:

```bash
php craft sluggish-queue/listen --verbose
```

## Troubleshooting

See the knowledge base article on [Resolving Failed Queue Jobs](kb:resolving-failed-queue-jobs) for a list of common queue problems.
Expand Down

0 comments on commit d27e8d2

Please sign in to comment.