Esempio n. 1
0
 /**
  * Write a frame to the stomp server
  *
  * example: $response = $client->write($frame)->read();
  *
  * @param Zend_Queue_Stom_FrameInterface $frame
  * @return $this
  */
 public function write(Zend_Queue_Stomp_FrameInterface $frame)
 {
     $this->ping();
     $output = $frame->toFrame();
     $bytes = fwrite($this->_socket, $output, strlen($output));
     if ($bytes === false || $bytes == 0) {
         require_once 'Zend/Queue/Exception.php';
         throw new Zend_Queue_Exception('No bytes written');
     }
     return $this;
 }
 public function getMessageFromFrame(\Zend_Queue_Stomp_FrameInterface $frame, Zend_Queue $queue)
 {
     $messageClass = $queue->getMessageClass();
     $message = $frame->getBody();
     return new $messageClass(array('queue' => $queue, 'data' => array('message_id' => $frame->getHeader('message-id') ?: null, 'body' => $message, 'md5' => md5($message), 'handle' => $frame->getHeader('message-id') ?: null)));
 }