Exemplo n.º 1
0
 /**
  * @inheritdoc
  */
 public function read()
 {
     if ($frame = parent::read()) {
         $this->seq = $frame['seq'];
     }
     return $frame;
 }
Exemplo n.º 2
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();
 }