Created
December 14, 2020 21:27
-
-
Save mchmielarz/122a80a28f90cde825448b9a1f59454b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component | |
public class PartitionedKafkaListenerConsumer { | |
@KafkaListener( | |
clientIdPrefix = "part0", | |
topics = "${spring.kafka.consumer.topic}", | |
groupId = "${spring.kafka.consumer.group-id}", | |
topicPartitions = { | |
@TopicPartition(topic = "${spring.kafka.consumer.topic}", partitions = {"0"}) | |
}) | |
public void partition0(ConsumerRecord<String, String> content) { | |
// processing logic comes here | |
} | |
@KafkaListener( | |
clientIdPrefix = "part1", | |
topics = "${spring.kafka.consumer.topic}", groupId = "${spring.kafka.consumer.group-id}", | |
topicPartitions = { | |
@TopicPartition(topic = "${spring.kafka.consumer.topic}", partitions = {"1"}) | |
}) | |
public void partition1(ConsumerRecord<String, String> content) { | |
// processing logic comes here | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment