How to manually control the offset commit with camel-kafka?

后端 未结 3 1415
小鲜肉
小鲜肉 2021-01-16 05:59

I\'m using the camel kafka component and I\'m unclear what is happening under the hood with committing the offsets. As can be seen below, I\'m aggregating records and I thin

3条回答
  •  一个人的身影
    2021-01-16 06:51

    I think this is change in the latest version of camel (2.22.0) (the doc) you should be able to do that.

    // Endpoint configuration &autoCommitEnable=false&allowManualCommit=true
    public void process(Exchange exchange) {
         KafkaManualCommit manual = exchange.getIn().getHeader(KafkaConstants.MANUAL_COMMIT, KafkaManualCommit.class);
         manual.commitSync();
    }
    

提交回复
热议问题