示例#1
0
 public function basicGet($ticket = 0, $queue = '', $no_ack = false)
 {
     $args = new AMQPWriter();
     $args->write_short($ticket);
     $args->write_shortstr($queue);
     $args->write_bit($no_ack);
     return array(60, 70, $args);
 }
示例#2
0
 /**
  * serialize the 'properties' attribute (a dictionary) into the
  * raw bytes making up a set of property flags and a property
  * list, suitable for putting into a content frame header.
  */
 public function serialize_properties()
 {
     $shift = 15;
     $flag_bits = 0;
     $flags = array();
     $raw_bytes = new AMQPWriter();
     foreach ($this->prop_types as $key => $proptype) {
         if (isset($this->properties[$key])) {
             $val = $this->properties[$key];
         } else {
             $val = null;
         }
         if ($val != null) {
             if ($shift == 0) {
                 $flags[] = $flag_bits;
                 $flag_bits = 0;
                 $shift = 15;
             }
             $flag_bits |= 1 << $shift;
             if ($proptype != "bit") {
                 $raw_bytes->{'write_' . $proptype}($val);
             }
         }
         $shift -= 1;
     }
     $flags[] = $flag_bits;
     $result = new AMQPWriter();
     foreach ($flags as $flag_bits) {
         $result->write_short($flag_bits);
     }
     $result->write($raw_bytes->getvalue());
     return $result->getvalue();
 }
 /**
  * negotiate connection tuning parameters
  */
 protected function x_tune_ok($channel_max, $frame_max, $heartbeat)
 {
     $args = new AMQPWriter();
     $args->write_short($channel_max);
     $args->write_long($frame_max);
     $args->write_short($heartbeat);
     $this->send_method_frame(array(10, 31), $args);
     $this->wait_tune_ok = false;
 }
示例#4
0
 public function testInteger($integer_1, $integer_2, $integer_3, $integer_4, $operation)
 {
     $args = new AMQPWriter();
     $args->write_octet($integer_1);
     $args->write_short($integer_2);
     $args->write_long($integer_3);
     $args->write_longlong($integer_4);
     $args->write_octet($operation);
     return array(120, 10, $args);
 }