예제 #1
0
파일: Connection.php 프로젝트: swk/bluebox
 protected function x_start_ok($client_properties, $mechanism, $response, $locale)
 {
     $args = new AMQP_Writer();
     $args->write_table($client_properties);
     $args->write_shortstr($mechanism);
     $args->write_longstr($response);
     $args->write_shortstr($locale);
     $this->send_method_frame(array(10, 11), $args);
 }
예제 #2
0
파일: Channel.php 프로젝트: swk/bluebox
 /**
  * publish a message
  */
 public function basic_publish($msg, $exchange = "", $routing_key = "", $mandatory = false, $immediate = false, $ticket = NULL)
 {
     $args = new AMQP_Writer();
     if ($ticket != NULL) {
         $args->write_short($ticket);
     } else {
         $args->write_short($this->default_ticket);
     }
     $args->write_shortstr($exchange);
     $args->write_shortstr($routing_key);
     $args->write_bit($mandatory);
     $args->write_bit($immediate);
     $this->send_method_frame(array(60, 40), $args);
     $this->connection->send_content($this->channel_id, 60, 0, strlen($msg->body), $msg->serialize_properties(), $msg->body);
 }
예제 #3
0
파일: Writer.php 프로젝트: swk/bluebox
 /**
  * Write PHP array, as table. Input array format: keys are strings,
  * values are (type,value) tuples.
  */
 public function write_table($d)
 {
     $this->flushbits();
     $table_data = new AMQP_Writer();
     foreach ($d as $k => $va) {
         list($ftype, $v) = $va;
         $table_data->write_shortstr($k);
         if ($ftype == 'S') {
             $table_data->write('S');
             $table_data->write_longstr($v);
         } else {
             if ($ftype == 'I') {
                 $table_data->write('I');
                 $table_data->write_signed_long($v);
             } else {
                 if ($ftype == 'D') {
                     // 'D' type values are passed AMQPDecimal instances.
                     $table_data->write('D');
                     $table_data->write_octet($v->e);
                     $table_data->write_signed_long($v->n);
                 } else {
                     if ($ftype == 'T') {
                         $table_data->write('T');
                         $table_data->write_timestamp($v);
                     } else {
                         if ($ftype = 'F') {
                             $table_data->write('F');
                             $table_data->write_table($v);
                         }
                     }
                 }
             }
         }
     }
     $table_data = $table_data->getvalue();
     $this->write_long(strlen($table_data));
     $this->write($table_data);
 }