Example #1
0
 /**
  * @expectedException \Stomp\Broker\Exception\UnsupportedBrokerException
  */
 public function testBrowserWontWorkWithNonApolloBroker()
 {
     $client = $this->getMockBuilder(Client::class)->disableOriginalConstructor()->setMethods(['getProtocol'])->getMock();
     $client->method('getProtocol')->willReturn(new RabbitMq('client-id'));
     /**
      * @var $client Client
      */
     $browser = new QueueBrowser($client, 'target');
     $browser->subscribe();
 }
 /**
  * @inheritdoc
  */
 public function read()
 {
     if ($frame = parent::read()) {
         $this->seq = $frame['seq'];
     }
     return $frame;
 }
Example #3
0
 public function testQueueBrowserWithContinueListeningForNew()
 {
     $client = ClientProvider::getClient();
     $client->getConnection()->setReadTimeout(0, 500000);
     $browser = new QueueBrowser($client, self::$queue, false);
     $browser->subscribe();
     for ($i = 1; $i < 6; $i++) {
         $frame = $browser->read();
         $this->assertInstanceOf(Frame::class, $frame);
         $this->assertEquals(sprintf('message-%d', $i), $frame->body);
     }
     $this->assertFalse($browser->read());
     $this->assertFalse($browser->hasReachedEnd());
     $producer = ClientProvider::getClient();
     $producer->send(self::$queue, new Message('message-6', ['expires' => self::$expires + 20000]));
     $producer->disconnect(true);
     $frame = $browser->read();
     $this->assertInstanceOf(Frame::class, $frame);
     $this->assertEquals('message-6', $frame->body);
     $browser->unsubscribe();
 }