Skip to content

Instantly share code, notes, and snippets.

@mchmielarz
Created December 15, 2020 10:23
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mchmielarz/d3150a8a9fbec795cf758ad32a15bec4 to your computer and use it in GitHub Desktop.
@KafkaListener(groupId = "micronaut-group", clientId = "${kafka.consumers.micronaut-group.client-id}", batch = true)
public class BatchedMicronautListener {
@Topic("${kafka.consumers.micronaut-group.topic}")
void receive(List<ConsumerRecord<String, String>> records) {
log.info("Batch received: {}", records.size());
records.forEach(rec ->
// processing logic comes here
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment