Queue auto-delete configuration support

This commit is contained in:
2026-06-23 13:15:57 +04:00
parent ac735d8bf5
commit dce2a19295
2 changed files with 6 additions and 2 deletions

View File

@@ -24,7 +24,7 @@ class Consume extends Command
/** /**
* @var string * @var string
*/ */
protected $signature = 'rabbitmq:consume {--connection=} {--queue=} {--exchange=} {--exchange-type=} {--exchange-is-default} {--routing-key=} {--tag=}'; protected $signature = 'rabbitmq:consume {--connection=} {--queue=} {--queue-auto-delete} {--exchange=} {--exchange-type=} {--exchange-is-default} {--routing-key=} {--tag=}';
/** /**
* @var string * @var string
@@ -99,7 +99,9 @@ class Consume extends Command
{ {
return new Queue( return new Queue(
name: $params->queue->value() ?? 'default', name: $params->queue->value() ?? 'default',
declaration: new QueueDeclaration(), declaration: new QueueDeclaration(
autoDelete: $params->queueAutoDelete->toBool()
),
bindings: new QueueBindings($params->routingKey->toString()), bindings: new QueueBindings($params->routingKey->toString()),
); );
} }

View File

@@ -10,6 +10,7 @@ use Diffhead\PHP\Dto\Property;
/** /**
* @property \Diffhead\PHP\Dto\Property<string|null> $connection * @property \Diffhead\PHP\Dto\Property<string|null> $connection
* @property \Diffhead\PHP\Dto\Property<string|null> $queue * @property \Diffhead\PHP\Dto\Property<string|null> $queue
* @property \Diffhead\PHP\Dto\Property<bool> $queueAutoDelete
* @property \Diffhead\PHP\Dto\Property<string|null> $exchange * @property \Diffhead\PHP\Dto\Property<string|null> $exchange
* @property \Diffhead\PHP\Dto\Property<string|null> $routingKey * @property \Diffhead\PHP\Dto\Property<string|null> $routingKey
* @property \Diffhead\PHP\Dto\Property<string|null> $exchangeType * @property \Diffhead\PHP\Dto\Property<string|null> $exchangeType
@@ -20,6 +21,7 @@ class ConsumerParameters extends Dto
{ {
protected Property $connection; protected Property $connection;
protected Property $queue; protected Property $queue;
protected Property $queueAutoDelete;
protected Property $exchange; protected Property $exchange;
protected Property $routingKey; protected Property $routingKey;
protected Property $exchangeType; protected Property $exchangeType;