Interface KafkaMessageContext
- All Superinterfaces:
MessageContext<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>>
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 TypeMethodDescriptionorg.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.voidMarks the processing of the current message as successfully completed.voidSets the result of processing the current Kafka message.voidsetResult(PayloadData data) Sets the result of processing the current message with the given payload.voidsetResult(String key, PayloadData data) Sets the result of processing the current message with a payload associated with a specific key.voidsetResult(String key, PayloadData data, String replyTo) Sets the result of processing the current message with a payload and a target reply destination.voidSets 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:
getMessagein interfaceMessageContext<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>> - Returns:
- the
ConsumerRecordbeing processed
-
getRecord
org.apache.kafka.clients.consumer.ConsumerRecord<?,?> getRecord()Returns the Kafka consumer record associated with this context.- Returns:
- the
ConsumerRecordbeing processed
-
setResult
void setResult()Marks the processing of the current message as successfully completed.This is a convenience method for setting a default successful
Resultwithout any payload or additional metadata. -
setResult
Sets the result of processing the current message with the given payload.The provided
PayloadDatais typically used as the response or output of the message processing.- Parameters:
data- thePayloadDatato include in the result
-
setResult
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 resultdata- thePayloadDatato include in the result
-
setResult
Sets the result of processing the current message with a payload and a target reply destination.The
replyToparameter specifies where the result should be sent, such as a Kafka topic or logical endpoint.- Parameters:
key- the key associated with the resultdata- thePayloadDatato include in the resultreplyTo- the destination to which the result should be sent
-
setResult
Sets the result of processing the current message with a payload, reply destination, and additional headers.- Parameters:
key- the key associated with the resultdata- thePayloadDatato include in the resultreplyTo- the destination to which the result should be sentheaders- additional headers to include with the result
-
setResult
Sets the result of processing the current Kafka message.The provided
Resultrepresents the outcome of the message handling, such as success, retry, or failure.- Parameters:
result- theResultrepresenting the processing outcome
-