예제 #1
0
 /**
  * @param \PhpAmqpLib\Connection\AbstractConnection $connection
  * @param null $channel_id
  * @param bool $auto_decode
  * @throws \Exception
  */
 public function __construct($connection, $channel_id = null, $auto_decode = true)
 {
     if ($channel_id == null) {
         $channel_id = $connection->get_free_channel_id();
     }
     parent::__construct($connection, $channel_id);
     $this->publish_cache = array();
     $this->publish_cache_max_size = 100;
     if ($this->debug) {
         MiscHelper::debug_msg('using channel_id: ' . $channel_id);
     }
     $this->default_ticket = 0;
     $this->is_open = false;
     $this->active = true;
     // Flow control
     $this->alerts = array();
     $this->callbacks = array();
     $this->auto_decode = $auto_decode;
     try {
         $this->x_open();
     } catch (\Exception $e) {
         $this->close();
         throw $e;
     }
 }