Table of Contents

Class Message<T>

Namespace
NuvTools.Notification.Messaging
Assembly
NuvTools.Notification.Messaging.dll

Represents a message envelope that wraps a strongly-typed payload and common messaging metadata.

public class Message<T> where T : class

Type Parameters

T

The type of the message body. Must be a reference type.

Inheritance
Message<T>
Inherited Members

Examples

var msg = new Message<Order>(order)
{
    Subject = "order.created",
    CorrelationId = correlationId,
    TimeToLive = TimeSpan.FromMinutes(30),
    Properties = { ["priority"] = "high" }
};

Remarks

This class is intended as a lightweight envelope used by message producers and consumers within the NuvTools.Notification.Messaging library. It carries the payload in Body and common metadata such as MessageId, CorrelationId, Subject, TimeToLive, and a flexible Properties map for custom headers.

The default constructor generates a new MessageId. The class itself does not impose any serialization or transport requirements — those are handled by the concrete sender/consumer implementations.

Constructors

Message(T)

Represents a message envelope that wraps a strongly-typed payload and common messaging metadata.

public Message(T body)

Parameters

body T

The message payload.

Examples

var msg = new Message<Order>(order)
{
    Subject = "order.created",
    CorrelationId = correlationId,
    TimeToLive = TimeSpan.FromMinutes(30),
    Properties = { ["priority"] = "high" }
};

Remarks

This class is intended as a lightweight envelope used by message producers and consumers within the NuvTools.Notification.Messaging library. It carries the payload in Body and common metadata such as MessageId, CorrelationId, Subject, TimeToLive, and a flexible Properties map for custom headers.

The default constructor generates a new MessageId. The class itself does not impose any serialization or transport requirements — those are handled by the concrete sender/consumer implementations.

Properties

Body

The strongly-typed message payload.

public T Body { get; set; }

Property Value

T

CorrelationId

Optional correlation identifier used to group related messages or correlate request/response flows.

public string? CorrelationId { get; set; }

Property Value

string

MessageId

A unique identifier for this message. Defaults to a newly generated GUID string.

public string MessageId { get; set; }

Property Value

string

Properties

Free-form dictionary for additional metadata/headers. Keys are strings and values can be any object. Consumers and transports may interpret these entries as needed.

public Dictionary<string, object> Properties { get; set; }

Property Value

Dictionary<string, object>

ScheduledEnqueueTime

Optional scheduled enqueue time. When set, the message will not be available for delivery until this time.

public DateTimeOffset? ScheduledEnqueueTime { get; set; }

Property Value

DateTimeOffset?

SessionId

Optional session identifier for session-enabled queues/topics. Messages with the same SessionId are processed sequentially.

public string? SessionId { get; set; }

Property Value

string

Subject

Optional subject or routing key describing the purpose or category of the message.

public string? Subject { get; set; }

Property Value

string

TimeToLive

Optional time-to-live for the message. When set, senders or transports may discard the message after this interval.

public TimeSpan? TimeToLive { get; set; }

Property Value

TimeSpan?