Interface MessageContext<T>

All Known Subinterfaces:
KafkaMessageContext
All Known Implementing Classes:
MessageContextBase

@API public interface MessageContext<T>
Provides contextual information for a message received from a messaging system and access to the Exception that occurred during message processing. It encapsulates both the message being processed and the associated failure.
Since:
2026.2.0
  • Method Details

    • getMessage

      T getMessage()
      Returns the message associated with the current delivery.
      Returns:
      the received message
    • resolveMessageText

      String resolveMessageText() throws Exception
      Attempts to resolve the content of the underlying message as text.

      The implementation may inspect the message type and apply appropriate conversion logic in order to produce a textual representation of the message payload.

      If the message content cannot be resolved or meaningfully represented as text, this method returns null.

      Returns:
      the message payload as a String, or null if the content cannot be resolved as text
      Throws:
      Exception
    • getException

      Exception getException()
      Returns the exception that occurred during message processing. Only present when an exception has occurred.
      Returns:
      the exception associated with the failure, or null
    • newChildJob

      JobCreator newChildJob()
      Returns a creator for creating new child job.
      Returns:
      the creator
    • afterComplete

      void afterComplete(Consumer<MessageContext.AfterCompleteContext> callback)
      Sets a callback that is invoked when message processing is complete.

      The callback is typically executed after the message has been handled. It may be used to perform post-processing actions after the associated job is persisted into the TIF database.

      Parameters:
      callback - the callback to invoke when message processing is complete