diff --git a/.travis.yml b/.travis.yml index b12489d..eb2ecf3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,9 @@ php: - 5.6 - 7.0 - 7.1 - - nightly + +env: + - VERSION=3.0.1 before_script: - composer install diff --git a/Dockerfile b/Dockerfile index 7b8ff03..860c8e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,7 +29,7 @@ RUN docker-php-ext-install -j$(nproc) zip \ && mkdir php-rdkafka \ && cd php-rdkafka \ && git clone https://github.com/arnaud-lb/php-rdkafka.git . \ - && git checkout php7 \ + && git checkout master \ && phpize \ && ./configure \ && make -j$(nproc) \ @@ -60,4 +60,5 @@ COPY phpunit.xml /opt/laravel-pubsub/ RUN composer dump-autoload --no-interaction -CMD ["/bin/bash"] +# Keep the container running so that can run tests manually +CMD ["php-fpm"] \ No newline at end of file diff --git a/src/PubSubConnectionFactory.php b/src/PubSubConnectionFactory.php index e0e97fd..c9cf585 100644 --- a/src/PubSubConnectionFactory.php +++ b/src/PubSubConnectionFactory.php @@ -91,11 +91,11 @@ protected function makeKafkaAdapter(array $config) $topicConf->set('auto.offset.reset', 'smallest'); $conf = $this->container->makeWith('pubsub.kafka.conf'); + $conf->set('group.id', array_get($config, 'consumer_group_id', 'php-pubsub')); $conf->set('metadata.broker.list', $config['brokers']); $conf->set('enable.auto.commit', 'false'); $conf->set('offset.store.method', 'broker'); - $conf->setDefaultTopicConf($topicConf); $consumer = $this->container->makeWith('pubsub.kafka.consumer', ['conf' => $conf]); diff --git a/tests/PubSubConnectionFactoryTest.php b/tests/PubSubConnectionFactoryTest.php index e2dcebe..cf4ab92 100644 --- a/tests/PubSubConnectionFactoryTest.php +++ b/tests/PubSubConnectionFactoryTest.php @@ -122,18 +122,15 @@ public function testMakeKafkaAdapter() 'broker', ]) ->once(); - $conf->shouldReceive('setDefaultTopicConf') - ->with($topicConf) - ->once(); - $container->shouldReceive('make') + $container->shouldReceive('makeWith') ->with('pubsub.kafka.conf') ->once() ->andReturn($conf); $consumer = Mockery::mock(\RdKafka\KafkaConsumer::class); - $container->shouldReceive('make') + $container->shouldReceive('makeWith') ->withArgs([ 'pubsub.kafka.consumer', ['conf' => $conf],