Message

The Message interface represents a message with a source and a body of generic types. It extends Identifier and CreateTimeCapable interfaces, indicating that each message has a unique identifier and creation time. The interface provides methods to manipulate message headers and to mark messages as read-only.

Parameters

SOURCE

The type of the message source, self-referential to allow for fluent API design.

T

The type of the message body.

Inheritors

Properties

Link copied to clipboard
abstract val body: T

The body of the message, containing the actual data payload of the message.

Link copied to clipboard
abstract override val createTime: Long

The create time of the message, represented as a Unix timestamp in milliseconds.

Link copied to clipboard
abstract val header: Header

The header of the message, containing metadata about the message.

Link copied to clipboard
abstract val id: String

Represents a unique identifier for the implementing entity.

Link copied to clipboard

Indicates whether the message is read-only, based on the state of the header.

Functions

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

Adds all entries from the provided map to the message header and returns the message itself for method chaining.

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

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

Link copied to clipboard
open fun withReadOnly(): SOURCE

Marks the message as read-only and returns the message itself for method chaining.