Table of Contents

Struct MessageEnvelopeBuilder

Namespace
Excalibur.Dispatch.Messaging
Assembly
Excalibur.Dispatch.dll

Builder for creating MessageEnvelopeStruct instances with pooled resources.

public struct MessageEnvelopeBuilder : IEquatable<MessageEnvelopeBuilder>
Implements
Inherited Members
Extension Methods

Methods

Build()

Constructs the final MessageEnvelopeStruct with all configured properties.

public MessageEnvelopeStruct Build()

Returns

MessageEnvelopeStruct

A new MessageEnvelopeStruct instance containing all the configured values.

Dispose()

Releases any resources associated with the builder (no resources to dispose for this struct).

public readonly void Dispose()

Equals(MessageEnvelopeBuilder)

Determines whether the specified builder is equal to the current builder.

public readonly bool Equals(MessageEnvelopeBuilder other)

Parameters

other MessageEnvelopeBuilder

Returns

bool

Equals(object?)

Determines whether the specified object is equal to the current builder.

public override readonly bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

Returns the hash code for this builder.

public override readonly int GetHashCode()

Returns

int

WithBody(ReadOnlyMemory<byte>)

Sets the message body content as a byte array.

public MessageEnvelopeBuilder WithBody(ReadOnlyMemory<byte> body)

Parameters

body ReadOnlyMemory<byte>

The serialized message body content.

Returns

MessageEnvelopeBuilder

The current builder instance for fluent chaining.

WithCorrelationId(string)

Sets the correlation identifier for message tracing and correlation.

public MessageEnvelopeBuilder WithCorrelationId(string correlationId)

Parameters

correlationId string

The correlation identifier that links related messages.

Returns

MessageEnvelopeBuilder

The current builder instance for fluent chaining.

WithHeader(string, string)

Adds or updates a single header in the message envelope.

public MessageEnvelopeBuilder WithHeader(string key, string value)

Parameters

key string

The header key.

value string

The header value.

Returns

MessageEnvelopeBuilder

The current builder instance for fluent chaining.

WithHeaders(params (string key, string value)[])

Adds or updates multiple headers in the message envelope.

public MessageEnvelopeBuilder WithHeaders(params (string key, string value)[] headers)

Parameters

headers (string key, string value)[]

An array of key-value pairs representing the headers to add.

Returns

MessageEnvelopeBuilder

The current builder instance for fluent chaining.

Exceptions

ArgumentNullException

Thrown when headers is null.

WithMessageId(string)

Sets the message identifier for the envelope.

public MessageEnvelopeBuilder WithMessageId(string messageId)

Parameters

messageId string

The unique identifier for the message.

Returns

MessageEnvelopeBuilder

The current builder instance for fluent chaining.

WithMessageType(string)

Sets the message type identifier for routing and deserialization.

public MessageEnvelopeBuilder WithMessageType(string messageType)

Parameters

messageType string

The type identifier of the message content.

Returns

MessageEnvelopeBuilder

The current builder instance for fluent chaining.

WithPriority(byte)

Sets the message priority level for queue processing order.

public MessageEnvelopeBuilder WithPriority(byte priority)

Parameters

priority byte

The priority level (0-255, with higher values indicating higher priority).

Returns

MessageEnvelopeBuilder

The current builder instance for fluent chaining.

WithTimeToLive(TimeSpan)

Sets the time-to-live duration for the message before it expires.

public MessageEnvelopeBuilder WithTimeToLive(TimeSpan timeToLive)

Parameters

timeToLive TimeSpan

The maximum duration the message should remain valid.

Returns

MessageEnvelopeBuilder

The current builder instance for fluent chaining.

WithTimestamp(DateTime)

Sets the message timestamp using a DateTime value.

public MessageEnvelopeBuilder WithTimestamp(DateTime timestamp)

Parameters

timestamp DateTime

The timestamp when the message was created.

Returns

MessageEnvelopeBuilder

The current builder instance for fluent chaining.

WithTimestampTicks(long)

Sets the message timestamp using tick values for high-precision timing.

public MessageEnvelopeBuilder WithTimestampTicks(long timestampTicks)

Parameters

timestampTicks long

The timestamp in ticks (100-nanosecond intervals).

Returns

MessageEnvelopeBuilder

The current builder instance for fluent chaining.

Operators

operator ==(MessageEnvelopeBuilder, MessageEnvelopeBuilder)

Determines whether two builders are equal.

public static bool operator ==(MessageEnvelopeBuilder left, MessageEnvelopeBuilder right)

Parameters

left MessageEnvelopeBuilder
right MessageEnvelopeBuilder

Returns

bool

operator !=(MessageEnvelopeBuilder, MessageEnvelopeBuilder)

Determines whether two builders are not equal.

public static bool operator !=(MessageEnvelopeBuilder left, MessageEnvelopeBuilder right)

Parameters

left MessageEnvelopeBuilder
right MessageEnvelopeBuilder

Returns

bool