// #atLeastOnceBatch
Consumer.Control control =
Consumer.committableSource(consumerSettings, Subscriptions.topics("topic1"))
.mapAsync(1, msg ->
business(msg.record().key(), msg.record().value())
.thenApply(done -> msg.committableOffset())
)
.batch(
20,
ConsumerMessage::createCommittableOffsetBatch,
ConsumerMessage.CommittableOffsetBatch::updated
)
.mapAsync(3, c -> c.commitJavadsl())
.to(Sink.ignore())
.run(materializer);
// #atLeastOnceBatch
我正在尝试至少一次批试Alpakka Kafka Connnector示例,并且遇到以下编译时错误
ConsumerMessage类型没有定义适用于此的createCommittableOffsetBatch(ConsumerMessage.CommittableOffset)
和 ConsumerMessage.CommittableOffsetBatch类型未定义此处适用的已更新(S,ConsumerMessage.CommittableOffset)
答案 0 :(得分:0)
这些在v 0.22中可用。不幸的是,与Akka Docs相比,Alpakka的文档缺乏一些。