Message

Represents a message with metadata headers and a typed body payload.

This interface defines the core structure of messages in the messaging system, providing access to headers for metadata, a typed body for the actual content, and methods for fluent manipulation. Messages can be marked as read-only to prevent modifications after creation or transmission.

Parameters

SOURCE

The self-referential type for fluent method chaining (typically the implementing class)

T

The type of the message body payload

Inheritors

Properties

Link copied to clipboard
abstract val body: T

The typed payload of the message.

Link copied to clipboard
abstract override val createTime: Long

The timestamp when this message was created, as a Unix timestamp in milliseconds.

Link copied to clipboard
abstract val header: Header

The header containing metadata about this message.

Link copied to clipboard
abstract val id: String

Represents a unique identifier for the implementing entity.

Link copied to clipboard

Indicates whether this message is in read-only mode.

Functions

Link copied to clipboard
open fun withHeader(additionalSource: Map<String, String>): SOURCE

Adds all key-value pairs from the provided map to the message header and returns the message for method chaining.

open fun withHeader(key: String, value: String): SOURCE

Adds a key-value pair to the message header and returns the message for method chaining.

Link copied to clipboard
open fun withReadOnly(): SOURCE

Marks this message as read-only and returns it for method chaining.