public function testGetters() { $protocol = new Protocol('client-id', Version::VERSION_1_1, 'server-id'); $this->assertEquals('client-id', $protocol->getClientId()); $this->assertEquals(Version::VERSION_1_1, $protocol->getVersion()); $this->assertEquals('server-id', $protocol->getServer()); }
/** * ActiveMq unsubscribe frame. * * @param string $destination * @param string $subscriptionId * @param bool|false $durable * @return Frame */ public function getUnsubscribeFrame($destination, $subscriptionId = null, $durable = false) { $frame = parent::getUnsubscribeFrame($destination, $subscriptionId); if ($durable) { $frame['activemq.subscriptionName'] = $this->getClientId(); } return $frame; }
/** * Apollo unsubscribe frame. * * @param string $destination * @param string $subscriptionId * @param bool|false $durable * @return \Stomp\Transport\Frame */ public function getUnsubscribeFrame($destination, $subscriptionId = null, $durable = false) { $frame = parent::getUnsubscribeFrame($destination, $subscriptionId); if ($durable) { $frame['persistent'] = 'true'; } return $frame; }
/** * Graceful disconnect from the server * @param bool $sync * @return void */ public function disconnect($sync = false) { try { if ($this->connection && $this->connection->isConnected()) { if ($this->protocol) { $this->sendFrame($this->protocol->getDisconnectFrame(), $sync); } } } catch (StompException $ex) { // nothing! } if ($this->connection) { $this->connection->disconnect(); } $this->sessionId = null; $this->unprocessedFrames = []; $this->protocol = null; $this->isConnecting = false; }
public function actionToProtocolProvider() { $protocol = new Protocol('test', Version::VERSION_1_2); return ['subscribe' => ['subscribe', ['/test/queue', 55, 'auto', 'S=5', ['myHeader' => 'myHeaderValue']], [$protocol->getSubscribeFrame('/test/queue', 55, 'auto', 'S=5')->addHeaders(['myHeader' => 'myHeaderValue']), null], true], 'unsubscribe' => ['unsubscribe', ['/test/queue', 44, ['myHeader' => 'myHeaderValue']], [$protocol->getUnsubscribeFrame('/test/queue', 44)->addHeaders(['myHeader' => 'myHeaderValue']), null], true], 'begin' => ['begin', [11211], [$protocol->getBeginFrame(11211), false], true], 'commit' => ['commit', [2211], [$protocol->getCommitFrame(2211), false], true], 'abort' => ['abort', [1122], [$protocol->getAbortFrame(1122), false], true], 'ack' => ['ack', [new Frame('MESSAGE', ['id' => 121])], [$protocol->getAckFrame(new Frame('MESSAGE', ['id' => 121])), false], null], 'nack' => ['nack', [new Frame('MESSAGE', ['ack' => 212])], [$protocol->getNackFrame(new Frame('MESSAGE', ['ack' => 212])), false], null]]; }