I'm implementing and dsl spring integration flow which takes messages from Kafka
Code snippet:
return IntegrationFlows.from(
Kafka.messageDrivenChannelAdapter(new DefaultKafkaConsumerFactory(kafkaTelemetryDataConsumerConfiguration.getConsumerProperties()),
kafkaPropertiesConfiguration.getTelemetryDataTopic()))
})
.handle(bla.someImportantOperation())
//TODO:do manual commit here
//.handle(consumer.commitSync())
.get();
I would like to know how can I manually commitSync but only after .handle(bla.someImportantOperation()) has successfuly finished.
I don't know how to get the consumer reference since I'm using DefaultKafkaConsumerFactory, would appreciate any help.
These are my consumerProperties I use to create consumer:
consumerProperties.setProperty(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaPropertiesConfiguration.getBootstrapServers());
consumerProperties.setProperty(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
consumerProperties.setProperty(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class.getName());
consumerProperties.setProperty(ConsumerConfig.CLIENT_ID_CONFIG, kafkaPropertiesConfiguration.getClientIdConfig());
consumerProperties.setProperty(ConsumerConfig.GROUP_ID_CONFIG, kafkaPropertiesConfiguration.getGroupIdConfig());
consumerProperties.setProperty(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, "false");