Пример #1
0
 function initChannel()
 {
     $pl = $this->myConn->getProtocolLoader();
     $meth = new wire\Method($pl('ClassFactory', 'GetMethod', array('channel', 'open')), $this->chanId);
     $meth->setField('reserved-1', '');
     $resp = $this->myConn->invoke($meth);
 }
Пример #2
0
 /**
  * Factory method creates wire\Method  objects based on class name
  * and parameters.
  *
  * @arg  string   $class       Amqp class
  * @arg  array    $_args       Format: array (<Amqp method name>,
  *                                            <Assoc method/class mixed field array>,
  *                                            <Message content>)
  * @return                     A corresponding \amqphp\wire\Method
  */
 function constructMethod($class, $_args)
 {
     $method = isset($_args[0]) ? $_args[0] : null;
     $args = isset($_args[1]) ? $_args[1] : array();
     $content = isset($_args[2]) ? $_args[2] : null;
     $pl = $this->getProtocolLoader();
     if (!($cls = $pl('ClassFactory', 'GetClassByName', array($class)))) {
         throw new \Exception("Invalid Amqp class or php method", 8691);
     } else {
         if (!($meth = $cls->getMethodByName($method))) {
             throw new \Exception("Invalid Amqp method", 5435);
         }
     }
     $m = new wire\Method($meth);
     foreach ($args as $k => $v) {
         $m->setField($k, $v);
     }
     $m->setContent($content);
     return $m;
 }