From e1e679d7f64ad609856e0a25a63b88f548407a64 Mon Sep 17 00:00:00 2001 From: Tobias Bohn Date: Wed, 22 Nov 2023 09:19:58 +0100 Subject: [PATCH] allow custom configs and hard coded values only fallback i added the support to set the configs "socket.timeout.ms" and "queue.buffering.max.ms" to custom values. the previously hardcoded values will be set as default if no value is provided --- src/Producer/KafkaProducerBuilder.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Producer/KafkaProducerBuilder.php b/src/Producer/KafkaProducerBuilder.php index ffada2a..487488f 100644 --- a/src/Producer/KafkaProducerBuilder.php +++ b/src/Producer/KafkaProducerBuilder.php @@ -157,8 +157,8 @@ public function build(): KafkaProducerInterface } //Thread termination improvement (https://github.com/arnaud-lb/php-rdkafka#performance--low-latency-settings) - $this->config['socket.timeout.ms'] = '50'; - $this->config['queue.buffering.max.ms'] = '1'; + $this->config['socket.timeout.ms'] = $this->config['socket.timeout.ms'] ?? '50'; + $this->config['queue.buffering.max.ms'] = $this->config['queue.buffering.max.ms'] ?? '1'; if (function_exists('pcntl_sigprocmask')) { pcntl_sigprocmask(SIG_BLOCK, array(SIGIO));