44
55namespace Jobcloud \Kafka \Conf ;
66
7+ use Jobcloud \Kafka \Consumer \KafkaConsumerBuilder ;
78use Jobcloud \Kafka \Consumer \TopicSubscription ;
89use RdKafka \Conf as RdKafkaConf ;
910use RdKafka \TopicConf as RdKafkaTopicConf ;
@@ -21,6 +22,11 @@ class KafkaConfiguration extends RdKafkaConf
2122 */
2223 protected $ topicSubscriptions ;
2324
25+ /**
26+ * @var string
27+ */
28+ private $ type ;
29+
2430 /**
2531 * @var array<string,int>
2632 */
@@ -33,14 +39,15 @@ class KafkaConfiguration extends RdKafkaConf
3339 * @param string[] $brokers
3440 * @param array|TopicSubscription[] $topicSubscriptions
3541 * @param mixed[] $config
42+ * @param string $type
3643 */
37- public function __construct (array $ brokers , array $ topicSubscriptions , array $ config = [])
44+ public function __construct (array $ brokers , array $ topicSubscriptions , array $ config = [], string $ type = '' )
3845 {
3946 parent ::__construct ();
4047
4148 $ this ->brokers = $ brokers ;
4249 $ this ->topicSubscriptions = $ topicSubscriptions ;
43-
50+ $ this -> type = $ type ;
4451 $ this ->initializeConfig ($ config );
4552 }
4653
@@ -81,7 +88,10 @@ protected function initializeConfig(array $config = []): void
8188 continue ;
8289 }
8390
84- if (true === $ this ->isLowLevelTopicConfSetting ($ name )) {
91+ if (
92+ KafkaConsumerBuilder::CONSUMER_TYPE_LOW_LEVEL === $ this ->type
93+ && true === $ this ->isLowLevelTopicConfSetting ($ name )
94+ ) {
8595 $ topicConf ->set ($ name , (string ) $ value );
8696 $ this ->setDefaultTopicConf ($ topicConf );
8797 }
0 commit comments