Interface KafkaMessageContext

All Superinterfaces:
MessageContext<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>>

@API public interface KafkaMessageContext extends MessageContext<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>>
A ProcessingContext implementation for Kafka-based message processing.

KafkaMessageContext extends the generic processing context with access to the underlying Kafka ConsumerRecord. It provides message-specific details required during the processing of records consumed from a Kafka topic.

Since:
2026.2.0
  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.technia.tif.enovia.messaging.MessageContext

    MessageContext.AfterCompleteContext
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.kafka.clients.consumer.ConsumerRecord<?,?>
    Returns the Kafka consumer record instance associated with this context.
    org.apache.kafka.clients.consumer.ConsumerRecord<?,?>
    Returns the Kafka consumer record associated with this context.
    void
    Marks the processing of the current message as successfully completed.
    void
    setResult(Result result)
    Sets the result of processing the current Kafka message.
    void
    Sets the result of processing the current message with the given payload.
    void
    Sets the result of processing the current message with a payload associated with a specific key.
    void
    setResult(String key, PayloadData data, String replyTo)
    Sets the result of processing the current message with a payload and a target reply destination.
    void
    setResult(String key, PayloadData data, String replyTo, Map<String,Object> headers)
    Sets the result of processing the current message with a payload, reply destination, and additional headers.

    Methods inherited from interface com.technia.tif.enovia.messaging.MessageContext

    afterComplete, getException, newChildJob, resolveMessageText
  • Method Details

    • getMessage

      org.apache.kafka.clients.consumer.ConsumerRecord<?,?> getMessage()
      Returns the Kafka consumer record instance associated with this context.

      This method is an alias for getRecord().

      Specified by:
      getMessage in interface MessageContext<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>>
      Returns:
      the ConsumerRecord being processed
    • getRecord

      org.apache.kafka.clients.consumer.ConsumerRecord<?,?> getRecord()
      Returns the Kafka consumer record associated with this context.
      Returns:
      the ConsumerRecord being processed
    • setResult

      void setResult()
      Marks the processing of the current message as successfully completed.

      This is a convenience method for setting a default successful Result without any payload or additional metadata.

    • setResult

      void setResult(PayloadData data)
      Sets the result of processing the current message with the given payload.

      The provided PayloadData is typically used as the response or output of the message processing.

      Parameters:
      data - the PayloadData to include in the result
    • setResult

      void setResult(String key, PayloadData data)
      Sets the result of processing the current message with a payload associated with a specific key.

      The key may be used for routing, partitioning, or identifying the result in downstream systems.

      Parameters:
      key - the key associated with the result
      data - the PayloadData to include in the result
    • setResult

      void setResult(String key, PayloadData data, String replyTo)
      Sets the result of processing the current message with a payload and a target reply destination.

      The replyTo parameter specifies where the result should be sent, such as a Kafka topic or logical endpoint.

      Parameters:
      key - the key associated with the result
      data - the PayloadData to include in the result
      replyTo - the destination to which the result should be sent
    • setResult

      void setResult(String key, PayloadData data, String replyTo, Map<String,Object> headers)
      Sets the result of processing the current message with a payload, reply destination, and additional headers.

      Parameters:
      key - the key associated with the result
      data - the PayloadData to include in the result
      replyTo - the destination to which the result should be sent
      headers - additional headers to include with the result
    • setResult

      void setResult(Result result)
      Sets the result of processing the current Kafka message.

      The provided Result represents the outcome of the message handling, such as success, retry, or failure.

      Parameters:
      result - the Result representing the processing outcome