예제 #1
0
파일: Connection.php 프로젝트: swk/bluebox
 /**
  * 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;
 }
예제 #2
0
파일: Channel.php 프로젝트: swk/bluebox
 /**
  * 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"));
 }
예제 #3
0
파일: Content.php 프로젝트: swk/bluebox
 /**
  * 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();
 }