Interface KafkaMessageReceiver

All Known Implementing Classes:
KafkaDefaultMessageReceiver

@API public interface KafkaMessageReceiver
Defines a contract for handling messages consumed from Kafka.

KafkaMessageReceiver represents a component responsible for processing incoming Kafka messages within a KafkaMessageContext. Implementations contain the business logic required to handle the message and determine the outcome of processing.

The provided KafkaMessageContext gives access to both the underlying Kafka record and additional processing capabilities, such as job creation and callbacks.

Since:
2026.2.0
  • Method Details

    • onMessage

      void onMessage(KafkaMessageContext ctx) throws Exception
      Handles an incoming Kafka message.

      This method is invoked for each consumed message and is expected to implement the processing logic for that message.

      Parameters:
      ctx - the KafkaMessageContext associated with the message
      Throws:
      Exception - if message processing fails; throwing an exception signals a processing error to the caller
    • onException

      void onException(KafkaMessageContext ctx)
      Called when an exception occurs during message processing.
      Parameters:
      ctx - the exception context associated with the failed message