示例#1
0
 /**
  * Tests Stomp->connect(), send(), and subscribe() - out of order. the messages should be received in FIFO order.
  */
 public function testAsyncSub()
 {
     $this->assertTrue($this->Stomp->connect());
     $this->assertTrue($this->Stomp->send('/queue/test', 'test 1'));
     $this->assertTrue($this->Stomp->send('/queue/test', 'test 2'));
     $this->assertTrue($this->simpleStomp->subscribe('/queue/test', 'mysubid'));
     $frame = $this->Stomp->readFrame();
     $this->assertEquals($frame->body, 'test 1', 'test 1 was not received!');
     $frame = $this->Stomp->readFrame();
     $this->assertEquals($frame->body, 'test 2', 'test 2 was not received!');
 }
示例#2
0
 public function testAbortTransaction()
 {
     $this->assertTrue($this->Stomp->connect());
     $this->assertTrue($this->simpleStomp->begin('my-id'));
     $this->assertTrue($this->Stomp->send('/queue/test', 'test t-id', ['transaction' => 'my-id']));
     $this->assertTrue($this->simpleStomp->abort('my-id'));
     $this->assertTrue($this->simpleStomp->subscribe('/queue/test', 'mysubid'));
     $this->Stomp->getConnection()->setReadTimeout(0, 500000);
     $frame = $this->Stomp->readFrame();
     $this->assertFalse($frame);
 }
示例#3
0
 /**
  * Tests Stomp byte messages
  */
 public function testByteMessages()
 {
     if (!$this->stomp->isConnected()) {
         $this->stomp->connect();
     }
     $body = 'test';
     $mapMessage = new Bytes($body);
     $this->stomp->send('/queue/bytes', $mapMessage);
     $simpleStomp = new SimpleStomp($this->stomp);
     $simpleStomp->subscribe('/queue/bytes');
     $msg = $this->stomp->readFrame();
     $this->assertEquals($msg->body, $body);
     $this->stomp->disconnect();
 }
示例#4
0
 /**
  * Tests Stomp byte messages
  */
 public function testByteMessages()
 {
     if (!$this->Stomp->isConnected()) {
         $this->Stomp->connect();
     }
     $body = 'test';
     $mapMessage = new Bytes($body);
     $this->Stomp->send($this->queue, $mapMessage);
     $this->Stomp->disconnect(true);
     $this->simpleStomp->subscribe($this->queue, 'mysubid');
     $msg = $this->Stomp->readFrame();
     $this->assertEquals($msg->body, $body);
     $this->simpleStomp->ack($msg);
     $this->Stomp->disconnect();
 }
示例#5
0
 /**
  * Send a message
  *
  * @param $destination
  * @param Message $message
  * @return bool
  * @throws StompException
  */
 public function send($destination, Message $message)
 {
     return $this->client->send($destination, $message);
 }
示例#6
0
 /**
  * @inheritdoc
  */
 public function send($data, Config $config)
 {
     $headers = $config->getParameters();
     $this->stompClient->send($config->getDestination(), $data, $headers);
 }