public function testReceive()
 {
     $client = new Client($this->host, $this->port);
     $client->setKafkaVersion('0.8.2.2');
     $client->connect();
     $correlationId = mt_rand(-32768, 32767);
     $joinGroupRequest = new JoinGroupRequest($client);
     $joinGroupRequest->setCorrelationId($correlationId);
     $joinGroupRequest->send('ConsumerGroup1', 6000, 'MemberId1', 'consumer', ['ProtocolName1' => 'ProtocolMetadata1']);
     $response = $joinGroupRequest->receive();
     $this->assertInternalType('array', $response);
     $this->assertArrayHasKey('CorrelationId', $response);
     $this->assertSame($correlationId, $response['CorrelationId']);
 }
Пример #2
0
 public function testReceive()
 {
     $client = new Client($this->host, $this->port);
     $client->setKafkaVersion('0.8.2.2');
     $client->connect();
     $correlationId = mt_rand(-32768, 32767);
     $fetchRequest = new FetchRequest($client);
     $fetchRequest->setCorrelationId($correlationId);
     $fetchRequest->send(-1, 100, 1024, ['kafka_talker_unit_tests_1' => [0 => ['offset' => 8589934593, 'max_bytes' => 100 * 1024 * 1024]]]);
     $response = $fetchRequest->receive();
     //$this->assertInternalType('array', $response);
     //$this->assertArrayHasKey('CorrelationId', $response);
     //$this->assertSame($correlationId, $response['CorrelationId']);
 }
 public function testReceive()
 {
     $client = new Client($this->host, $this->port);
     $client->setKafkaVersion('0.8.2.2');
     $client->connect();
     $correlationId = mt_rand(-32768, 32767);
     $groupCoordinatorRequest = new GroupCoordinatorRequest($client);
     $groupCoordinatorRequest->setCorrelationId($correlationId);
     $groupCoordinatorRequest->send('ConsumerGroup1');
     $response = $groupCoordinatorRequest->receive();
     $this->assertInternalType('array', $response);
     $this->assertArrayHasKey('CorrelationId', $response);
     $this->assertSame($correlationId, $response['CorrelationId']);
 }
 public function testReceive()
 {
     $client = new Client($this->host, $this->port);
     $client->setKafkaVersion('0.8.2.2');
     $client->connect();
     $correlationId = mt_rand(-32768, 32767);
     $offsetFetchRequest = new OffsetFetchRequest($client);
     $offsetFetchRequest->setCorrelationId($correlationId);
     $offsetFetchRequest->send('toto', ['test1' => [0]]);
     $response = $offsetFetchRequest->receive();
     $this->assertInternalType('array', $response);
     $this->assertArrayHasKey('CorrelationId', $response);
     $this->assertSame($correlationId, $response['CorrelationId']);
 }
Пример #5
0
 public function testReceive()
 {
     $client = new Client($this->host, $this->port);
     $client->setKafkaVersion('0.8.2.2');
     $client->connect();
     $correlationId = mt_rand(-32768, 32767);
     $offsetRequest = new OffsetRequest($client);
     $offsetRequest->setCorrelationId($correlationId);
     $offsetRequest->send(-1, ['kafka_talker_unit_tests_1' => [0 => ['Time' => -1, 'MaxNumberOfOffsets' => 100000]]]);
     $response = $offsetRequest->receive();
     $this->assertInternalType('array', $response);
     $this->assertArrayHasKey('CorrelationId', $response);
     $this->assertSame($correlationId, $response['CorrelationId']);
 }
Пример #6
0
 public function testReceive()
 {
     $client = new Client($this->host, $this->port);
     $client->setKafkaVersion('0.8.2.2');
     $client->connect();
     $correlationId = mt_rand(-32768, 32767);
     $produceRequest = new ProduceRequest($client);
     $produceRequest->setCorrelationId($correlationId);
     $produceRequest->send(1, 6000, ['kafka_talker_unit_tests_1' => [0 => ['one', 'two', 'three', 'four']]]);
     $response = $produceRequest->receive();
     $this->assertInternalType('array', $response);
     $this->assertArrayHasKey('CorrelationId', $response);
     $this->assertSame($correlationId, $response['CorrelationId']);
 }
 public function testReceive()
 {
     $client = new Client($this->host, $this->port);
     $client->setKafkaVersion('0.8.2.2');
     $client->connect();
     $correlationId = mt_rand(-32768, 32767);
     $syncGroupRequest = new SyncGroupRequest($client);
     $syncGroupRequest->setCorrelationId($correlationId);
     $syncGroupRequest->send('GroupId1', 'GenerationId1', 'MemberId1', [['MemberId' => 'MemberId1', 'MemberAssignment' => 'MemberAssignment1']]);
     $response = $syncGroupRequest->receive();
     $this->assertInternalType('array', $response);
     $this->assertArrayHasKey('CorrelationId', $response);
     $this->assertSame($correlationId, $response['CorrelationId']);
 }
 public function testReceive()
 {
     $client = new Client($this->host, $this->port);
     $client->setKafkaVersion('0.8.2.2');
     $client->connect();
     $correlationId = mt_rand(-32768, 32767);
     $describeGroupsRequest = new DescribeGroupsRequest($client);
     $describeGroupsRequest->setCorrelationId($correlationId);
     $describeGroupsRequest->send(['GroupId1', 'GroupId2']);
     $response = $describeGroupsRequest->receive();
     $this->assertInternalType('array', $response);
     $this->assertArrayHasKey('CorrelationId', $response);
     $this->assertSame($correlationId, $response['CorrelationId']);
     $this->assertArrayHasKey('Groups', $response);
     $this->assertInternalType('array', $response['Groups']);
 }
 public function testReceive()
 {
     $client = new Client($this->host, $this->port);
     $client->setKafkaVersion('0.8.2.2');
     $client->connect();
     $correlationId = mt_rand(-32768, 32767);
     $leaveGroupRequest = new LeaveGroupRequest($client);
     $leaveGroupRequest->setCorrelationId($correlationId);
     $leaveGroupRequest->send('GroupId1', 'MemberId1');
     $response = $leaveGroupRequest->receive();
     $this->assertInternalType('array', $response);
     $this->assertArrayHasKey('CorrelationId', $response);
     $this->assertSame($correlationId, $response['CorrelationId']);
     $this->assertArrayHasKey('ErrorCode', $response);
     $this->assertInternalType('int', $response['ErrorCode']);
 }
 public function testReceiveV0()
 {
     $client = new Client($this->host, $this->port);
     $client->setKafkaVersion('0.8.2.2');
     $client->connect();
     $correlationId = mt_rand(-32768, 32767);
     $offsetCommitRequest = new OffsetCommitRequest($client);
     $offsetCommitRequest->setCorrelationId($correlationId);
     $offsetCommitRequest->sendV0('toto', ['test1' => [0 => ['Offset' => 2, 'Metadata' => '']]]);
     /*
             $offsetCommitRequest->sendV1(
                 'ConsumerGroup1',
                 'ConsumerGroupGenerationId1',
                 'ConsumerId',
                 [
                     'kafka_talker_unit_tests_1' => [
                         0 => ['Offset' => 4, 'Timestamp' => ((int) date('U')) + 6000, 'Metadata' => 'toto']
                     ]
                 ]
             );
             $offsetCommitRequest->sendV2(
                 'ConsumerGroup1',
                 1,
                 'ConsumerId',
                 6000,
                 [
                     'kafka_talker_unit_tests_1' => [
                         0 => ['Offset' => 4, 'Metadata' => 'toto']
                     ]
                 ]
             );
     */
     $response = $offsetCommitRequest->receive();
     $this->assertInternalType('array', $response);
     $this->assertArrayHasKey('CorrelationId', $response);
     $this->assertSame($correlationId, $response['CorrelationId']);
 }