/** * return a failed message * * @param \AMQP\Wire\Reader $args */ protected function basicReturn(\AMQP\Wire\Reader $args) { $reply_code = $args->readShort(); $reply_text = $args->readShortstr(); $exchange = $args->readShortstr(); $routing_key = $args->readShortstr(); $msg = $this->wait(); }
/** * Read an AMQP table, and return as a PHP array. keys are strings, * values are (type,value) tuples. * * @return array * @throws \Exception */ public function readTable() { $this->_bitcount = $this->_bits = 0; $tlen = $this->readPhpInt(); if ($tlen < 0) { throw new \Exception('Table is longer than supported'); } $tableData = new Reader($this->_rawread($tlen)); $result = array(); while ($tableData->tell() < $tlen) { $name = $tableData->readShortstr(); $ftype = $tableData->_rawread(1); if ($ftype == 'S') { $val = $tableData->readLongstr(); } else { if ($ftype == 'I') { $val = $tableData->_readSignedLong(); } else { if ($ftype == 'D') { $e = $tableData->readOctet(); $n = $tableData->_readSignedLong(); $val = new Decimal($n, $e); } else { if ($ftype == 'T') { $val = $tableData->readTimestamp(); } else { if ($ftype == 'F') { $val = $tableData->readTable(); // recursion } else { error_log(sprintf('Usupported table field type %s', $ftype)); $val = null; } } } } } $result[$name] = array($ftype, $val); } return $result; }
/** * asks the client to use a different server * * @param \AMQP\Wire\Reader $args * * @return string */ protected function redirect(Reader $args) { $host = $args->readShortstr(); $this->knownHosts = $args->readShortstr(); if ($this->debug) { Helper::debugMsg(sprintf('Redirected to [%s], known_hosts [%s]', $host, $this->knownHosts)); } return $host; }