Skip to content

Commit

Permalink
add group.id.prefix in consumer.yaml #35
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianSaipSenacor committed Feb 2, 2023
1 parent ce33858 commit 4c69b32
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/at/esque/kafka/handlers/ConsumerHandler.java
Expand Up @@ -55,8 +55,10 @@ public void setRegisteredConsumers(Map<UUID, KafkaConsumer> registeredConsumers)
public UUID registerConsumer(ClusterConfig config, TopicMessageTypeConfig topicMessageTypeConfig, Map<String, String> consumerConfigs) throws MissingSchemaRegistryException {
Properties consumerProps = new Properties();
consumerProps.setProperty(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, config.getBootStrapServers());
String groupIdPrefix = Optional.ofNullable(consumerConfigs.get("group.id.prefix"))
.orElse("kafkaesque-");
UUID consumerId = UUID.randomUUID();
consumerProps.setProperty(ConsumerConfig.GROUP_ID_CONFIG, "kafkaesque-" + consumerId);
consumerProps.setProperty(ConsumerConfig.GROUP_ID_CONFIG, groupIdPrefix + consumerId);
consumerProps.setProperty(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, "false");
consumerProps.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, KafkaEsqueDeserializer.class);
consumerProps.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, KafkaEsqueDeserializer.class);
Expand Down

0 comments on commit 4c69b32

Please sign in to comment.