xincheng / yii2-rabbitmq
Wrapper based on php-amqplib to incorporate messaging in your Yii2 application via RabbitMQ. Inspired by RabbitMqBundle for Symfony 2, really awesome package.
Package info
github.com/thinksvip/yii2-rabbitmq
Type:yii2-extension
pkg:composer/xincheng/yii2-rabbitmq
Requires
- php: ^7.4 || ^8.0
- php-amqplib/php-amqplib: ^3.7.4
- yiisoft/yii2: ^2.0.55
Requires (Dev)
- phpunit/phpunit: ^9.6.30
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-21 17:08:20 UTC
README
English · 简体中文
Wrapper based on php-amqplib library to incorporate messaging in your Yii2 application via RabbitMQ. Inspired by RabbitMqBundle for Symfony framework.
xincheng/yii2-rabbitmq is an independently maintained fork of mikemadisonweb/yii2-rabbitmq.
This branch supports PHP 7.4 and PHP 8.x, including PHP 8.5. It requires Yii 2.0.55 or later in the 2.x series and php-amqplib 3.7.4 or later in the 3.x series. For legacy PHP applications >=5.4 please use the previous version of this extension.
Installation
Install the extension with Composer.
composer require xincheng/yii2-rabbitmq
If you are switching from the upstream package, remove mikemadisonweb/yii2-rabbitmq from your application's Composer requirements before installing the fork. Both packages use the same PHP namespace (mikemadisonweb\rabbitmq), so existing imports and Yii class references continue to work.
Configuration
This extension facilitates the creation of RabbitMQ producers and consumers to meet your specific needs. This is an example basic config:
<?php return [ // should be in common.php 'components' => [ // ... 'rabbitmq' => [ 'class' => \mikemadisonweb\rabbitmq\Configuration::class, 'connections' => [ [ // You can pass these parameters as a single `url` option: https://www.rabbitmq.com/uri-spec.html 'host' => 'YOUR_HOSTNAME', 'port' => '5672', 'user' => 'YOUR_USERNAME', 'password' => 'YOUR_PASSWORD', 'vhost' => '/', ] // When multiple connections is used you need to specify a `name` option for each one and define them in producer and consumer configuration blocks ], 'exchanges' => [ [ 'name' => 'YOUR_EXCHANGE_NAME', 'type' => 'direct' // Refer to Defaults section for all possible options ], ], 'queues' => [ [ 'name' => 'YOUR_QUEUE_NAME', // Queue can be configured here the way you want it: //'durable' => true, //'auto_delete' => false, ], [ 'name' => 'YOUR_ANOTHER_QUEUE_NAME', ], ], 'bindings' => [ [ 'queue' => 'YOUR_QUEUE_NAME', 'exchange' => 'YOUR_EXCHANGE_NAME', 'routing_keys' => ['YOUR_ROUTING_KEY'], ], ], 'producers' => [ [ 'name' => 'YOUR_PRODUCER_NAME', ], ], 'consumers' => [ [ 'name' => 'YOUR_CONSUMER_NAME', // Every consumer should define one or more callbacks for corresponding queues 'callbacks' => [ // queue name => callback class name 'YOUR_QUEUE_NAME' => \path\to\YourConsumer::class, ], ], ], ], ], ];
To use this extension you should be familiar with the basic concepts of RabbitMQ. If you are not confident in your knowledge I suggest reading this article.
The 'callback' parameter can be a class name or a service name from dependency injection container. Starting from Yii version 2.0.11 you can configure your container like this:
<?php use yii\di\Instance; return [ // ... 'container' => [ 'definitions' => [], 'singletons' => [ 'rabbitmq.import-data.consumer' => [ [ 'class' => \path\to\YourConsumer::class, ], [ // If dependency is needed 'some-dependency' => Instance::of('dependency-service-name'), ], ], ], ], ];
If you need several consumers you can list respective entries in the configuration, but that would require a separate worker(daemon process) for each of that consumers. While it can be absolutely fine in some cases if you are dealing with small queues which consuming messages really fast you may want to group them into one worker. So just list your callbacks in consumer config and one worker will perform your business logic on multiple queues.
Be sure that all queues and exchanges are defined in corresponding bindings, it's up to you to set up correct message routing.
Lifecycle events
There are also some lifecycle events implemented: before_consume, after_consume, before_publish, after_publish. You can use them for any additional work you need to do before or after message been consumed/published. For example, make sure that Yii knows the database connection has been closed by a timeout as a consumer is a long-running process:
<?php // config/main.php return [ // ... 'components' => [ // ... 'rabbitmq' => [ // ... 'on before_consume' => function ($event) { if (\Yii::$app->has('db') && \Yii::$app->db->isActive) { try { \Yii::$app->db->createCommand('SELECT 1')->query(); } catch (\yii\db\Exception $exception) { \Yii::$app->db->close(); } } }, ], // ... ], ];
Logger
Last but not least is logger configuration which is also optional:
<?php // config/main.php return [ // ... 'components' => [ // ... 'rabbitmq' => [ // ... 'logger' => [ 'log' => true, 'category' => 'application', 'print_console' => false, 'system_memory' => false, ], ], // ... ], ];
Logger disabled by default. When enabled it will log messages into main application log or to your own log target if you specify corresponding category name. Option 'print_console' gives you additional information while debugging a consumer in you console.
Example
Simple setup of Yii2 basic template with the RabbitMQ extension is available here. Feel free to experiment with it and debug your existing configuration in an isolated manner.
Console commands
Extension provides several console commands:
- rabbitmq/consume - Run a consumer
- rabbitmq/restart-consume - Start the named consumer on a fresh connection in the current process. To reload a running systemd-managed worker, send SIGHUP to its main process.
- rabbitmq/declare-all - Create RabbitMQ exchanges, queues and bindings based on configuration
- rabbitmq/declare-exchange - Create the exchange listed in configuration
- rabbitmq/declare-queue - Create the queue listed in configuration
- rabbitmq/delete-all - Delete all RabbitMQ exchanges and queues that is defined in configuration
- rabbitmq/delete-exchange - Delete the exchange
- rabbitmq/delete-queue - Delete the queue
- rabbitmq/publish - Publish a message from STDIN to the queue
- rabbitmq/purge-queue - Delete all messages from the queue
To start a consumer:
yii rabbitmq/consume YOUR_CONSUMER_NAME
In this case, you can use process control system, like Supervisor, to restart consumer process and this way keep your worker run continuously.
Message limit
As PHP daemon especially based upon a framework may be prone to memory leaks, it may be reasonable to limit the number of messages to consume and stop:
--memoryLimit, -l: (defaults to 0)
--messagesLimit, -m: (defaults to 0)
Auto-declare
By default extension configured in auto-declare mode, which means that on every message published exchanges, queues and bindings will be checked and created if missing. If performance means much to your application you should disable that feature in configuration and use console commands to declare and delete routing schema by yourself.
Set declare to false on a queue or exchange managed outside the application. Automatic setup and rabbitmq/declare-all skip creating that resource. Configured bindings still use it. The explicit declare-queue and declare-exchange commands can create it.
Multiple vhosts
Give each connection a name and use that name in the connection option on producers and consumers. To restrict a queue, exchange or binding to one vhost, set its connection to the same name.
'connections' => [ ['name' => 'a', 'host' => 'localhost', 'vhost' => '/a'], ['name' => 'b', 'host' => 'localhost', 'vhost' => '/b'], ], 'exchanges' => [ ['name' => 'events', 'type' => 'direct'], ], 'queues' => [ ['name' => 'orders', 'connection' => 'a'], ['name' => 'billing', 'connection' => 'b'], ], 'bindings' => [ ['exchange' => 'events', 'queue' => 'orders', 'routing_keys' => ['order']], ['exchange' => 'events', 'queue' => 'billing', 'routing_keys' => ['invoice']], ],
Running yii rabbitmq/declare-all a creates the events exchange, the orders queue and its binding in /a. Running it for b creates events and billing in /b. Queues and exchanges with no connection apply to every selected connection. Bindings apply where their endpoints are available. Distinct connections may configure the same queue or exchange name with different options.
Single active consumer on a specific vhost
Configure SAC in Yii
Enable Single Active Consumer (SAC) when declaring a classic or quorum queue. In the Yii configuration loaded by your console application, set components.rabbitmq.queues[].arguments for the target queue. The entry 'x-single-active-consumer' => ['t', true] sends the boolean value true to RabbitMQ. SAC is built into the broker and takes effect when the queue is first created. RabbitMQ single active consumer
This example uses connection a for both the queue and the consumer, so both point to vhost /a. Use your broker credentials and a callback class that implements ConsumerInterface. If connection a already exists, reuse it and append the queue and consumer entries to your existing lists.
<?php return [ 'components' => [ 'rabbitmq' => [ 'class' => \mikemadisonweb\rabbitmq\Configuration::class, 'connections' => [[ 'name' => 'a', 'host' => 'localhost', 'vhost' => '/a', 'user' => 'YOUR_USERNAME', 'password' => 'YOUR_PASSWORD', ]], 'queues' => [[ 'name' => 'jobs.sac', 'connection' => 'a', 'arguments' => ['x-single-active-consumer' => ['t', true]], ]], 'consumers' => [[ 'name' => 'jobs-worker', 'connection' => 'a', 'callbacks' => ['jobs.sac' => \app\consumers\JobsConsumer::class], 'qos' => ['prefetch_count' => 1], ]], ], ], ];
Declare the new queue from the Yii application, then check its arguments on the broker.
php yii rabbitmq/declare-queue jobs.sac a rabbitmqctl list_queues -p /a name arguments
The jobs.sac row should contain x-single-active-consumer with the boolean value true. If an operator creates the queue in RabbitMQ Management, select vhost /a and enter the same key under Arguments, with type Boolean and value true. Use the same queue arguments in every application that declares this queue.
Start and check the two workers
Run the following command in two separate terminals, or configure your process supervisor to run two copies.
php yii rabbitmq/consume jobs-worker
Both workers subscribe to jobs.sac in /a. RabbitMQ chooses the active worker and promotes the standby if the active worker disconnects. The optional prefetch_count setting limits how many unacknowledged messages the active worker can hold.
Run rabbitmqctl list_consumers -p /a queue_name consumer_tag active on the broker. For jobs.sac, expect two subscriptions, one with active set to true and one with false.
Migrating an existing queue
RabbitMQ sets single active consumer at queue creation. Adding the argument to an existing ordinary queue named jobs and redeclaring it gives 406 PRECONDITION_FAILED. To migrate within /a while preserving queued messages, use a new name such as jobs.sac.
- Keep the existing
jobsqueue and its workers running. Add and declarejobs.sacas shown above, using a distinct consumer name ifjobs-workeris already in use. - Switch all publishers on connection
ato the new queue. With the default exchange (''), change the routing key fromjobstojobs.sac. With a direct exchange, bind the new queue to a new routing key before switching publishers. This keeps each publication routed to one queue during the change. - Let the old workers finish the backlog. After all publishers and retry routes have switched, run
rabbitmqctl list_queues -p /a name messages_ready messages_unacknowledged. Once both counts onjobsstay at zero, stop the old workers. Remove the old consumer, queue and bindings from application configuration before retiring the broker resources so auto-declaration cannot recreate them. - Start the two new workers as shown above. Starting them after the old queue drains also keeps the old backlog ahead of new jobs.
Usage
As the consumer worker will read messages from the queue, execute a callback method and pass a message to it.
Consume
In order a class to become a callback it should implement ConsumerInterface:
<?php namespace components\rabbitmq; use mikemadisonweb\rabbitmq\components\ConsumerInterface; use PhpAmqpLib\Message\AMQPMessage; class YourConsumer implements ConsumerInterface { /** * @param AMQPMessage $msg * @return bool */ public function execute(AMQPMessage $msg) { $data = $msg->body; // Apply your business logic here return ConsumerInterface::MSG_ACK; } }
You can publish any data type(object, int, array etc), despite the fact that RabbitMQ will transfer payload as a string here in consumer $msg->body your data will be of the same type it was sent.
Return codes
As for the return codes there is a bunch of them in order for you to control following processing of the message by the broker:
- ConsumerInterface::MSG_ACK - Acknowledge message (mark as processed) and drop it from the queue
- ConsumerInterface::MSG_REJECT - Reject and drop message from the queue
- ConsumerInterface::MSG_REQUEUE - Reject and requeue message in RabbitMQ
With proceed_on_exception enabled, a callback or deserialization error requeues the delivery and frees its prefetch slot. A message that always fails can be redelivered repeatedly. Return MSG_REJECT for a permanent failure to use the queue's dead-letter policy. Return one of the result codes to let the consumer settle the delivery.
If the consumer loses its broker connection, it attempts to reconnect once and restores its subscriptions and QoS. RabbitMQ can redeliver a message when its acknowledgement was interrupted, so callbacks should tolerate processing the same message again.
When consume() exits, it releases the consumer's delivery channel. RabbitMQ can then redeliver any prefetched messages left unprocessed, including on the next consume() call. Other channels on the shared connection stay available.
SIGTERM, SIGINT and SIGHUP record a stop or restart request. The main loop applies it after the active wait or delivery finishes, preserving the original idle_timeout semantics. With a positive idle timeout, an idle signal request may take effect only when that wait ends. Allow enough shutdown time for waiting and task execution.
When repeatedly creating temporary routers for an external connection, call $routing->close() after use. It releases only that router's channel, keeping the shared connection and other channels available. Destruction also attempts cleanup, and a closed router can be reused. reset() only discards session state after a disconnect; use close() to release a live channel.
Long-running consumers
A long-running callback needs a healthy broker connection and enough time to acknowledge its delivery. For example, a worker processing one report at a time can request a 15-second heartbeat and limit prefetch to one message.
'connections' => [[ 'name' => 'batch', 'host' => 'localhost', 'vhost' => '/a', 'heartbeat' => 15, 'read_write_timeout' => 35, // seconds ]], 'queues' => [['name' => 'reports', 'connection' => 'batch']], 'consumers' => [[ 'name' => 'report-worker', 'connection' => 'batch', 'callbacks' => ['reports' => \app\components\ReportConsumer::class], 'qos' => ['prefetch_count' => 1], ]],
The extension defaults to heartbeat = 0, which disables its callback heartbeat sender. After changing the Yii connection settings, restart the existing worker through its process supervisor so the new connection negotiates the heartbeat. With a positive heartbeat, CLI PHP with pcntl and an available SIGALRM sends heartbeats from before_consume through after_consume. The worker restores its previous signal settings after each delivery.
When using --withoutSignals=1, running without pcntl or reserving SIGALRM for the application, split the callback into bounded steps and call Yii::$app->rabbitmq->getConnection('batch')->checkHeartBeat() between steps, roughly every half heartbeat. A native call that blocks PHP longer than the heartbeat timeout can run in a subprocess while the consumer polls for completion and sends heartbeats. RabbitMQ heartbeats
The broker's delivery acknowledgement deadline runs from delivery until the callback returns and the extension acknowledges it. Heartbeat frames keep the connection active while that clock continues to run. The consumer's idle_timeout controls how long it waits for a delivery. For jobs that can take up to one hour, for example, allow two hours on each broker node in rabbitmq.conf.
consumer_timeout = 7200000
From RabbitMQ 3.12, a queue policy can set a deadline in milliseconds for a specific queue and vhost. For an existing classic queue on RabbitMQ 4.2, the following command sets two hours for reports in /a. If the queue already uses a policy, add the key to its effective policy. RabbitMQ 4.2 acknowledgement timeouts
rabbitmqctl set_policy -p /a --apply-to classic_queues reports-timeout '^reports$' '{"consumer-timeout":7200000}'
RabbitMQ 4.2 defaults to 30 minutes and closes the channel with PRECONDITION_FAILED when the deadline expires. From RabbitMQ 4.3, only quorum queues enforce delivery acknowledgement timeouts. For a quorum queue on these versions use --apply-to quorum_queues. Expired deliveries can be redelivered and the broker can cancel the AMQP 0-9-1 consumer or close its channel. RabbitMQ acknowledgement timeouts
Worker deployment settings
A starting point for production connections is heartbeat=15, read_write_timeout=35, and channel_rpc_timeout=5.0, adjusted for the deployment. The RPC timeout bounds operations such as declarations and bindings; the read/write timeout is not a replacement. Enabling keepalive=true also requires PHP's sockets extension. Set a finite prefetch based on message size and processing time, and use --memoryLimit and --messagesLimit to rotate workers.
Generated systemd units have separate startup, shutdown and restart settings. Each consumer can configure:
'systemd' => [ 'workers' => 2, 'memory_limit' => 256, 'timeout_stop_sec' => 300, 'restart_sec' => 5, ],
timeout_stop_sec defaults to 300 seconds and must exceed the maximum task duration plus acknowledgement grace. restart_sec defaults to 5 seconds; both accept positive integers. The startup timeout is 30 seconds. Regenerate and install the units, then run systemctl daemon-reload after changing these settings; existing service files are not updated automatically.
Publish
Here is an example how you can publish a message:
$producer = \Yii::$app->rabbitmq->getProducer('YOUR_PRODUCER_NAME'); $msg = serialize(['dataset_id' => 657, 'linked_datasets' => []]); $producer->publish($msg, 'YOUR_EXCHANGE_NAME', 'YOUR_ROUTING_KEY');
Routing key as third parameter is optional, which can be the case for fanout exchanges.
By default connection to broker only get established upon publishing a message, it would not try to connect on each HTTP request if there is no need to.
If the connection fails while preparing the channel or topology, the producer reconnects once before sending. If the write itself fails, publish() propagates the exception. Delivery is uncertain at that point, so retrying the message can produce a duplicate.
Replaying failed messages
RabbitPublishError::rePublish() uses the rabbitmqReplayMutex application component. If it is not configured, the model registers a yii\mutex\FileMutex using @runtime/mutex. The operating system releases the lock when the process exits or is killed. Replay processes on the same host must share their runtime path. When multiple hosts share the failed-message table, configure a database mutex shared by all instances, for example:
'components' => [ 'rabbitmqReplayMutex' => [ 'class' => \yii\mutex\PgsqlMutex::class, // Use MysqlMutex for MySQL. 'db' => 'db', ], ],
A model can select another mutex component with 'mutex' => 'customMutex'. Old rabbit_publish_error cache flags are no longer used.
Newly saved headers use versioned AMQP encoding to retain nested tables, arrays, explicit field types and binary data. Legacy JSON records remain readable, while unsupported header values fail during saving. For rolling upgrades, upgrade all replay workers before enabling new writers: old replay workers cannot read the new header format. Publishing semantics are unchanged; replay does not add broker confirms, and applications must still handle uncertain delivery and duplicates.
Options
For TLS, set the connection's port to the broker's TLS listener (usually 5671) and set ssl_context to an array of PHP TLS options such as ['cafile' => '/path/to/ca.pem']. The default connection opens lazily. Existing configurations that specify AMQPSSLConnection::class open TLS immediately and return an AMQPStreamConnection instance.
The legacy AMQPLazySSLConnection::class setting returns an AMQPLazyConnection and opens TLS on first use.
Connection URL queries accept only host, port, user, password, vhost, connection_timeout, read_write_timeout, keepalive, heartbeat, and channel_rpc_timeout. Query values override the corresponding URL and array fields before validation. keepalive accepts true/false/1/0; ports must be 1–65535, heartbeats 0–65535, and timeouts finite non-negative seconds. The RPC timeout must not exceed the read/write timeout. Unknown, repeated and nested query parameters are rejected during configuration loading. Remove previously ignored placeholders such as ?query or ?lazy=1; the connection type determines lazy opening.
All configuration options:
$rabbitmq_defaults = [ 'auto_declare' => true, 'connections' => [ [ 'name' => self::DEFAULT_CONNECTION_NAME, 'type' => AMQPLazyConnection::class, 'url' => null, 'host' => null, 'port' => 5672, 'user' => 'guest', 'password' => 'guest', 'vhost' => '/', 'connection_timeout' => 3, 'read_write_timeout' => 3, 'ssl_context' => null, 'keepalive' => false, 'heartbeat' => 0, 'channel_rpc_timeout' => 0.0 ], ], 'exchanges' => [ [ 'name' => null, 'connection' => null, 'type' => null, 'passive' => false, 'durable' => true, 'auto_delete' => false, 'internal' => false, 'nowait' => false, 'arguments' => null, 'ticket' => null, ], ], 'queues' => [ [ 'name' => '', 'connection' => null, 'passive' => false, 'durable' => true, 'exclusive' => false, 'auto_delete' => false, 'nowait' => false, 'arguments' => null, 'ticket' => null, ], ], 'bindings' => [ [ 'exchange' => null, 'connection' => null, 'queue' => null, 'to_exchange' => null, 'routing_keys' => [], ], ], 'producers' => [ [ 'name' => null, 'connection' => self::DEFAULT_CONNECTION_NAME, 'safe' => true, 'content_type' => 'text/plain', 'delivery_mode' => 2, 'serializer' => 'serialize', ], ], 'consumers' => [ [ 'name' => null, 'connection' => self::DEFAULT_CONNECTION_NAME, 'callbacks' => [], 'qos' => [ 'prefetch_size' => 0, 'prefetch_count' => 0, 'global' => false, ], 'idle_timeout' => 0, 'idle_timeout_exit_code' => null, 'proceed_on_exception' => false, 'deserializer' => 'unserialize', 'systemd' => [ 'memory_limit' => 0, 'workers' => 1, 'timeout_stop_sec' => 300, 'restart_sec' => 5, ], ], ], 'logger' => [ 'log' => false, 'category' => 'application', 'print_console' => true, 'system_memory' => false, ], ];
Exchange
For example, to declare an exchange you should provide name and type for it.
| parameter | required | type | default | comments |
|---|---|---|---|---|
| name | yes | string | The exchange name consists of a non-empty sequence of these characters: letters, digits, hyphen, underscore, period, or colon. | |
| type | yes | string | Type of the exchange, possible values are direct, fanout, topic and headers. |
|
| passive | no | boolean | false | If set to true, the server will reply with Declare-Ok if the exchange already exists with the same name, and raise an error if not. The client can use this to check whether an exchange exists without modifying the server state. When set, all other method fields except name and no-wait are ignored. A declare with both passive and no-wait has no effect. |
| durable | no | boolean | true | Durable exchanges remain active when a server restarts. Non-durable exchanges (transient exchanges) are purged if/when a server restarts. |
| auto_delete | no | boolean | false | If set to true, the exchange would be deleted when no queues are bound to it anymore. |
| internal | no | boolean | false | Internal exchange may not be used directly by publishers, but only when bound to other exchanges. |
| nowait | no | boolean | false | Client may send next request immediately after sending the first one, no waiting for the reply is required |
| arguments | no | array | null | A set of arguments for the declaration. |
| ticket | no | integer | null | Access ticket |
Good use-case of the arguments parameter usage can be a creation of a dead-letter-exchange.
Queue
As for the queue declaration, all parameters are optional. Even if you do not provide a name for your queue server will generate a unique name for you:
| parameter | required | type | default | comments |
|---|---|---|---|---|
| name | no | string | '' | The queue name can be empty, or a sequence of these characters: letters, digits, hyphen, underscore, period, or colon. |
| passive | no | boolean | false | If set to true, the server will reply with Declare-Ok if the queue already exists with the same name, and raise an error if not. |
| durable | no | boolean | true | Durable queues remain active when a server restarts. Non-durable queues (transient queues) are purged if/when a server restarts. |
| auto_delete | no | boolean | false | If set to true, the queue is deleted when all consumers have finished using it. |
| exclusive | no | boolean | false | Exclusive queues may only be accessed by the current connection, and are deleted when that connection closes. Passive declaration of an exclusive queue by other connections are not allowed. |
| nowait | no | boolean | false | Client may send next request immediately after sending the first one, no waiting for the reply is required |
| arguments | false | array | null | A set of arguments for the declaration. |
| ticket | no | integer | null | Access ticket |
A queue with an empty name uses the name returned by RabbitMQ on declaration. Keep nowait set to false to receive this name for bindings and consumers in the same connection session. Each consumer process using an exclusive server-named queue gets its own queue.
A complete explanation about options, their defaults, and valuable details can be found in AMQP 0-9-1 Reference Guide.
Beware that not all these options are allowed to be changed 'on-the-fly', in other words after queue or exchange had already been created. Otherwise, you will receive an error.
Breaking Changes
Since version 1.* this extension was completely rewritten internally and can be considered brand new. However, the following key differences can be distinguished:
- PHP version 7.0 and above required
- Configuration format changed
- All extension components get automatically loaded using Yii2 Bootstraping
- Different connection types supported
- All extension components are registered in DIC as singletons
- Routing component added to control schema in broker
- Queue and exchange default options changed
- Console commands are joined into one controller class which is added automatically and doesn't need to be configured
- New console commands added to manipulate with routing schema
- All data types are supported for message payload
- Consumer handles control signals in a predictable manner
Running the verification suite
Run composer install on PHP 7.4 or 8.5. The full suite uses the CLI extensions pcntl, sockets and pdo_sqlite. Xdebug with coverage enabled supplies the line report.
Use two disposable vhosts on a test broker, with credentials that can declare and delete test resources. Set RABBITMQ_TEST_URL_A and RABBITMQ_TEST_URL_B to their AMQP URLs. Set RABBITMQ_TEST_TLS_URL to the first vhost on the TLS port, using the same AMQP URL format, and RABBITMQ_TEST_TLS_CA to the PEM file for the test CA. The CI workflow prepares both vhosts and the TLS listener on a disposable RabbitMQ container.
XDEBUG_MODE=coverage vendor/bin/phpunit --fail-on-skipped --fail-on-risky --fail-on-warning --coverage-clover build/clover.xml sh tests/installation/run.sh
The installation test creates a separate Composer application with production dependencies, boots Yii console and web applications, and verifies a real delivery and acknowledgement in each.
License
This extension is distributed under the MIT License.