/** * @param \PhpAmqpLib\Connection\AbstractConnection $connection * @param $channel_id */ public function __construct(PhpAmqpLib_Connection_AbstractConnection $connection, $channel_id) { $this->connection = $connection; $this->channel_id = $channel_id; $connection->channels[$channel_id] = $this; $this->frame_queue = array(); // Lower level queue for frames $this->method_queue = array(); // Higher level queue for methods $this->auto_decode = false; $this->debug = defined('AMQP_DEBUG') ? AMQP_DEBUG : false; $this->protocolVersion = defined('AMQP_PROTOCOL') ? AMQP_PROTOCOL : '0.9.1'; switch ($this->protocolVersion) { case '0.9.1': self::$PROTOCOL_CONSTANTS_CLASS = 'PhpAmqpLib_Wire_Constants091'; $c = self::$PROTOCOL_CONSTANTS_CLASS; $this->amqp_protocol_header = $c::$AMQP_PROTOCOL_HEADER; $this->protocolWriter = new PhpAmqpLib_Helper_Protocol_Protocol091(); $this->waitHelper = new PhpAmqpLib_Helper_Protocol_Wait091(); $this->methodMap = new PhpAmqpLib_Helper_Protocol_MethodMap091(); break; case '0.8': self::$PROTOCOL_CONSTANTS_CLASS = 'PhpAmqpLib_Wire_Constants080'; $c = self::$PROTOCOL_CONSTANTS_CLASS; $this->amqp_protocol_header = $c::$AMQP_PROTOCOL_HEADER; $this->protocolWriter = new PhpAmqpLib_Helper_Protocol_Protocol080(); $this->waitHelper = new PhpAmqpLib_Helper_Protocol_Wait080(); $this->methodMap = new PhpAmqpLib_Helper_Protocol_MethodMap080(); break; default: throw new PhpAmqpLib_Exception_AMQPRuntimeException('Protocol: ' . $this->protocolVersion . ' not implemented.'); } }
/** * @param PhpAmqpLib_Connection_AbstractConnection $connection * @param $channel_id * @throws _PhpAmqpLib_Exception_AMQPRuntimeException */ public function __construct($connection, $channel_id) { $this->connection = $connection; $this->channel_id = $channel_id; $connection->channels[$channel_id] = $this; $this->frame_queue = array(); // Lower level queue for frames $this->method_queue = array(); // Higher level queue for methods $this->auto_decode = false; $this->debug = defined('AMQP_DEBUG') ? AMQP_DEBUG : false; $this->msg_property_reader = new PhpAmqpLib_Wire_AMQPReader(null); $this->wait_content_reader = new PhpAmqpLib_Wire_AMQPReader(null); $this->dispatch_reader = new PhpAmqpLib_Wire_AMQPReader(null); $this->protocolVersion = self::getProtocolVersion(); switch ($this->protocolVersion) { case self::PROTOCOL_091: self::$PROTOCOL_CONSTANTS_CLASS = 'PhpAmqpLib_Wire_Constants091'; $c = self::$PROTOCOL_CONSTANTS_CLASS; $this->amqp_protocol_header = self::getStaticProperty($c, 'AMQP_PROTOCOL_HEADER'); $this->protocolWriter = new PhpAmqpLib_Helper_Protocol_Protocol091(); $this->waitHelper = new PhpAmqpLib_Helper_Protocol_Wait091(); $this->methodMap = new PhpAmqpLib_Helper_Protocol_MethodMap091(); break; case self::PROTOCOL_080: self::$PROTOCOL_CONSTANTS_CLASS = 'PhpAmqpLib_Wire_Constants080'; $c = self::$PROTOCOL_CONSTANTS_CLASS; $this->amqp_protocol_header = self::getStaticProperty($c, 'AMQP_PROTOCOL_HEADER'); $this->protocolWriter = new PhpAmqpLib_Helper_Protocol_Protocol080(); $this->waitHelper = new PhpAmqpLib_Helper_Protocol_Wait080(); $this->methodMap = new PhpAmqpLib_Helper_Protocol_MethodMap080(); break; default: //this is logic exception (requires code changes to fix), so OutOfRange, not OutOfBounds or Runtime throw new PhpAmqpLib_Exception_AMQPOutOfRangeException(sprintf('Protocol version %s not implemented.', $this->protocolVersion)); } }