Added PublishEvent listener connection and queue configuration feature

This commit is contained in:
2025-12-31 16:39:48 +04:00
parent 7ae585ae29
commit c48cd4c7f4
11 changed files with 339 additions and 322 deletions

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Diffhead\PHP\LaravelRabbitMQ\Command;
use Diffhead\PHP\LaravelRabbitMQ\Dto\ConsumerParameters;
use Diffhead\PHP\LaravelRabbitMQ\Object\Connection;
use Diffhead\PHP\LaravelRabbitMQ\Object\ConnectionWithChannel;
use Diffhead\PHP\LaravelRabbitMQ\Object\Exchange;
use Diffhead\PHP\LaravelRabbitMQ\Object\ExchangeDeclaration;
use Diffhead\PHP\LaravelRabbitMQ\Object\Queue;
@@ -31,7 +31,7 @@ class Consume extends Command
*/
protected $description = 'Consume messages from RabbitMQ';
private ?Connection $connection = null;
private ?ConnectionWithChannel $connection = null;
public function handle(
Configuration $configuration,
@@ -40,7 +40,10 @@ class Consume extends Command
LoggerInterface $logger
): void {
$params = ConsumerParameters::fromArray($this->options());
$config = $configuration->get($params->connection->value() ?? 'default');
$config = $configuration->getConnection(
$params->connection->value() ?? 'default'
);
$queue = $this->getQueue($params);