Exemple #1
0
 /**
  * negotiate connection tuning parameters
  */
 protected function x_tune_ok($channel_max, $frame_max, $heartbeat)
 {
     $args = new AMQP_Writer();
     $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;
 }
Exemple #2
0
 /**
  * specify quality of service
  */
 public function basic_qos($prefetch_size, $prefetch_count, $a_global)
 {
     $args = new AMQP_Writer();
     $args->write_long($prefetch_size);
     $args->write_short($prefetch_count);
     $args->write_bit($a_global);
     $this->send_method_frame(array(60, 10), $args);
     return $this->wait(array("60,11"));
 }
Exemple #3
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 AMQP_Writer();
     foreach ($this->prop_types as $key => $proptype) {
         if (array_key_exists($key, $this->properties)) {
             $val = $this->properties[$key];
         } else {
             $val = NULL;
         }
         if ($val != NULL) {
             if ($shift == 0) {
                 array_push($flags, $flag_bits);
                 $flag_bits = 0;
                 $shift = 15;
             }
             $flag_bits |= 1 << $shift;
             if ($proptype != "bit") {
                 call_user_func(array($raw_bytes, "write_" . $proptype), $val);
             }
         }
         $shift -= 1;
     }
     array_push($flags, $flag_bits);
     $result = new AMQP_Writer();
     foreach ($flags as $flag_bits) {
         $result->write_short($flag_bits);
     }
     $result->write($raw_bytes->getvalue());
     return $result->getvalue();
 }