Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Yii2 Queue Laravel Package

yiisoft/yii2-queue

Yii2 Queue runs tasks asynchronously via pluggable queue backends: DB, Redis, RabbitMQ/AMQP, Beanstalk, ActiveMQ, and Gearman. Define jobs as classes implementing JobInterface and push them to the queue for background processing.

View on GitHub
Deep Wiki
Context7

AMQP Interop

このドライバは RabbitMQ のキューによって動作します。

amqp interop 互換のトランスポート、 例えば enqueue/amqp-lib パッケージを必要とします。

利点:

  • amqp interop 互換のトランスポートであれば、何でも動作します。例えば、

  • 優先度をサポート

  • 遅延をサポート

  • TTR をサポート

  • 試行回数をサポート

  • 新しいオプション: vhost, connection_timeout, qos_prefetch_count 等々

  • Secure (SSL) AMQP 接続をサポート

  • DSN を設定できる: 例えば、amqp:, amqps: または amqp://user:pass@localhost:1000/vhost

構成例:

return [
    'bootstrap' => [
        'queue', // コンポーネントが自身のコンソール・コマンドを登録します
    ],
    'components' => [
        'queue' => [
            'class' => \yii\queue\amqp_interop\Queue::class,
            'port' => 5672,
            'user' => 'guest',
            'password' => 'guest',
            'queueName' => 'queue',
            'driver' => yii\queue\amqp_interop\Queue::ENQUEUE_AMQP_LIB,

            // または
            'dsn' => 'amqp://guest:guest@localhost:5672/%2F',

            // または、上記と同じ
            'dsn' => 'amqp:',
        ],
    ],
];

コンソール

キューに入れられたジョブを実行するためにコンソール・コマンドが使用されます。

yii queue/listen

listen コマンドが無限にキューを調べ続けるデーモンを起動します。キューに新しいタスクがあると、即座に取得され、実行されます。 このコマンドを supervisor または systemd によって適切にデーモン化するのが、 最も効率的な方法です。

Working with headers in messages

The setMessageHeaders attribute can be used to send random headers to the queue along with the message.

For example:

$queue = Yii::$app->queueTest;
$queue->setMessageHeaders = [
    'header1' => 'header-value1',
    'header2' => 'header-value2',
];
$queue->push(new TestJob());

Note! Existing headers will not be overwritten by default.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle