Table of Contents

Interface IMemoryMessage

Namespace
Excalibur.Dispatch
Assembly
Excalibur.Dispatch.Abstractions.dll

Represents a message that can provide its body as Memory<byte> for zero-copy operations.

public interface IMemoryMessage : IDispatchMessage
Extension Methods

Properties

Body

Gets the message body as a Memory<byte>.

Memory<byte> Body { get; }

Property Value

Memory<byte>

The memory-backed payload for the message.

Remarks

This property enables zero-copy message processing by allowing messages to reference memory directly without copying data. The memory should remain valid for the lifetime of the message processing.

ContentType

Gets the content type of the message body.

string ContentType { get; }

Property Value

string

The MIME content type of the payload.

Remarks

Common values include "application/json", "application/octet-stream", "text/plain", etc. This helps consumers understand how to interpret the Body data.

OwnsMemory

Gets a value indicating whether the body memory is owned by this message.

bool OwnsMemory { get; }

Property Value

bool

true if the message owns the underlying memory; otherwise, false.

Remarks

When true, the message is responsible for managing the lifetime of the memory. When false, the memory is borrowed and should not be disposed by the message.