Rapids Kafka Client
Kafka Client is a vanilla java library that makes it easy to consume data from kafka, a list of features:
- Parallel consuming
- Consuming retry
- Consuming failover
- Designed to be easy to mock and test
- Designed to support slow consumers without kafka re balancing
- Designed to high throughput usage
- Individual record consuming
- Batch records consuming
- Frameworkless, but easily configurable to someone
- Commits are managed for you based on behavior
Getting Started
compile 'com.mageddo.kafka-client:rapids-kafka-client:1.0.2'
Consumers.<String, String>builder()
.prop(KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName())
.prop(VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName())
.prop(GROUP_ID_CONFIG, "stocks")
.topics("stock_changed")
.recoverCallback(ctx -> {
// here you can send the message to another topic, send a SMS, etc.
log.info("status=recovering, value={}", ctx.record().value());
})
.callback((ctx, record) -> {
log.info("status=consumed, value={}", record.value());
})
.build()
.consume()
.waitFor();