But more globally it'll allow anyone to retrieve the channel of a RabbitMQ connection using the swarrot.factory.default service (if you defined the provider as amqp_lib) and then do whatever you want with it (like retrieve a message, etc.).
For example you can retrieve one message (without ack'ing it) to retrieve the total messages in a queue:
$message = $this
->get('swarrot.factory.default')
->getChannel('rabbitmq') // returns a PhpAmqpLib\Channel\AMQPChannel
->basic_get('queue_name'); // returns a PhpAmqpLib\Message\AMQPMessage
var_dump($message->delivery_info['message_count']);
This will fix https://github.com/swarrot/SwarrotBundle/issues/97
But more globally it'll allow anyone to retrieve the channel of a RabbitMQ connection using the
swarrot.factory.default
service (if you defined the provider asamqp_lib
) and then do whatever you want with it (like retrieve a message, etc.).For example you can retrieve one message (without ack'ing it) to retrieve the total messages in a queue: