Skip to content
This repository was archived by the owner on Jul 19, 2024. It is now read-only.

Fix Dockerfile and remove deprecated setDefaultTopicConf() #19

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ php:
- 5.6
- 7.0
- 7.1
- nightly

env:
- VERSION=3.0.1

before_script:
- composer install
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down Expand Up @@ -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"]
2 changes: 1 addition & 1 deletion src/PubSubConnectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down
7 changes: 2 additions & 5 deletions tests/PubSubConnectionFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down