/** * Handles connection blocked notifications * * @param AMQPReader $args */ protected function connection_blocked(AMQPReader $args) { // Call the block handler and pass in the reason $this->dispatch_to_handler($this->connection_block_handler, array($args->read_shortstr())); }
/** * Returns a failed message * * @param AMQPReader $args * @param AMQPMessage $msg */ protected function basic_return($args, $msg) { $reply_code = $args->read_short(); $reply_text = $args->read_shortstr(); $exchange = $args->read_shortstr(); $routing_key = $args->read_shortstr(); if (null !== $this->basic_return_callback) { call_user_func_array($this->basic_return_callback, array($reply_code, $reply_text, $exchange, $routing_key, $msg)); } elseif ($this->debug) { MiscHelper::debug_msg('Skipping unhandled basic_return message'); } }
/** * @param AMQPReader $reader * @return array */ public static function basicGetEmpty(AMQPReader $reader) { $response = array(); $response[] = $reader->read_shortstr(); return $response; }
/** * @param AMQPReader $args * @return array */ public static function streamCancelOk($args) { $ret = array(); $ret[] = $args->read_shortstr(); return $ret; }
/** * Read an AMQP table, and return as a PHP array. keys are strings, * values are (type,value) tuples. */ public function read_table() { $this->bitcount = $this->bits = 0; $tlen = $this->read_php_int(); if ($tlen < 0) { throw new AMQPOutOfBoundsException("Table is longer than supported"); } $table_data = new AMQPReader($this->rawread($tlen), null); $result = array(); while ($table_data->tell() < $tlen) { $name = $table_data->read_shortstr(); $ftype = $table_data->rawread(1); $val = $table_data->read_value($ftype); $result[$name] = array($ftype, $val); } return $result; }
/** * @param AMQPReader $reader * @return array */ public static function streamCancelOk(AMQPReader $reader) { $response = array(); $response[] = $reader->read_shortstr(); return $response; }
protected function basic_cancel_from_server(AMQPReader $args) { $consumerTag = $args->read_shortstr(); throw new AMQPBasicCancelException($consumerTag); }
/** * Read an AMQP table, and return as a PHP array. keys are strings, * values are (type,value) tuples. * * @param bool $returnObject Whether to return AMQPArray instance instead of plain array * @return array|AMQPTable */ public function read_table($returnObject = false) { $this->bitcount = $this->bits = 0; $tlen = $this->read_php_int(); if ($tlen < 0) { throw new AMQPOutOfBoundsException('Table is longer than supported'); } $table_data = new AMQPReader($this->rawread($tlen), null); $result = $returnObject ? new AMQPTable() : array(); while ($table_data->tell() < $tlen) { $name = $table_data->read_shortstr(); $ftype = AMQPAbstractCollection::getDataTypeForSymbol($ftypeSym = $table_data->rawread(1)); $val = $table_data->read_value($ftype, $returnObject); $returnObject ? $result->set($name, $val, $ftype) : ($result[$name] = array($ftypeSym, $val)); } return $result; }
/** * @param AMQPReader $args * @return array */ public static function basicGetEmpty($args) { $ret = array(); $ret[] = $args->read_shortstr(); return $ret; }
/** * Returns a failed message * * @param AMQPReader $reader * @param AMQPMessage $message * @return null */ protected function basic_return($reader, $message) { $callback = $this->basic_return_callback; if (!is_callable($callback)) { $this->debug->debug_msg('Skipping unhandled basic_return message'); return null; } $reply_code = $reader->read_short(); $reply_text = $reader->read_shortstr(); $exchange = $reader->read_shortstr(); $routing_key = $reader->read_shortstr(); call_user_func_array($callback, array($reply_code, $reply_text, $exchange, $routing_key, $message)); }