/** * 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!'); }
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); }
/** * 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(); }
/** * 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(); }
/** * Send a message * * @param $destination * @param Message $message * @return bool * @throws StompException */ public function send($destination, Message $message) { return $this->client->send($destination, $message); }
/** * @inheritdoc */ public function send($data, Config $config) { $headers = $config->getParameters(); $this->stompClient->send($config->getDestination(), $data, $headers); }