bschmitt / laravel-amqp

AMQP wrapper for Laravel and Lumen to publish and consume messages
MIT License
268 stars 86 forks source link

Add check connection function. #119

Closed ValikoDorodnov closed 4 months ago

ValikoDorodnov commented 1 year ago

Added opportunity to check existing connection in \Bschmitt\Amqp\Request.

For example, if you publish messages in loop and don`t want to create a new connection every time, you may check existing one.

usage example

    public function __construct(
        private \Bschmitt\Amqp\Publisher $publisher
    )
    {
    }

    // usage in methods
   if (!$this->publisher->isConnected()) {
         $this->publisher->connect();
   }