Beispiel #1
0
 /**
  * @return Client
  */
 protected function getClient()
 {
     $client = ClientProvider::getClient();
     $client->setReceiptWait(2);
     return $client;
 }
Beispiel #2
0
 protected function consume()
 {
     $consumer = ClientProvider::getClient();
     $consumer->setClientId('test');
     $consumer->connect();
     $consumer->getConnection()->setReadTimeout(5);
     $simpleStomp = new SimpleStomp($consumer);
     $simpleStomp->subscribe($this->topic, 'myId', 'client-individual', null, ['durable' => 'true', 'auto-delete' => 'false']);
     $frame = $simpleStomp->read();
     $this->assertEquals($frame->body, 'test message');
     if ($frame != null) {
         $simpleStomp->ack($frame);
     }
     $simpleStomp->unsubscribe($this->topic, 'myId', ['durable' => 'true', 'auto-delete' => 'false']);
     $consumer->disconnect();
 }