Created
December 15, 2020 10:22
-
-
Save mchmielarz/aea5327c74dde46b5eddf6b4e3d18417 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
@KafkaListener(groupId = "micronaut-group", clientId = "${kafka.consumers.micronaut-group.client-id}", threads = 5) | |
public class MultithreadedMicronautListener { | |
@Topic("${kafka.consumers.micronaut-group.topic}") | |
void receive(@KafkaKey String key, String value, int partition) { | |
switch (partition) { | |
case 0: | |
// processing logic comes here | |
break; | |
case 1: | |
// processing logic comes here | |
break; | |
case 2: | |
// processing logic comes here | |
break; | |
default: | |
log.error("Message (key {}, value {}) from unexpected partition ({}) received.", key, value, partition); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment