How do I achieve FIFO behavior with Kafka?

devquora
devquora

Posted On: Feb 22, 2018

 

To achieve the FIFO behavior with Kafka, follow the steps mentioned below:

Set enable.auto.commit=false

  • After processing the message, don’t make a call to consumer.commitSync();
  • Make a call to ‘subscribe’ and register consumer to a topic.
  • Implement a consumerRebalance Listener and perform consumer.seek(topicPartition,offset); within the listener.
  • Process the messages, hold each message’s offset, store the processed message’s offset with that of the processed message using atomic-transaction.
  • Implement idempotent as a safety net.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Apache Kafka Interview Questions

    Please Explain Apache Kafka?

    It is a publish-subscribe messaging application and an open source message broker project started by Apache software. K..

    Apache Kafka Interview Questions

    In which language Apache Kafka is written?

    Kafka was written in Java and Scala programming languages...

    Apache Kafka Interview Questions

    What is Kafka message?

    Kafka messages can simply be defined as byte arrays that are used by developers to store objects in the format of String..