Class Message<T>
- Namespace
- Savvyio.Messaging
- Assembly
- Savvyio.Messaging.dll
Provides a default implementation of the IMessage<T> interface.
public class Message<T> : Acknowledgeable, IEquatable<Acknowledgeable>, IMessage<T>, IAcknowledgeable, IEquatable<Message<T>> where T : IRequest
Type Parameters
T
The type of the payload constraint to the IRequest interface.
- Inheritance
-
ObjectMessage<T>
- Implements
-
IEquatable<Acknowledgeable>IMessage<T>IEquatable<Message<T>>
- Inherited Members
- Extension Methods
Constructors
Message(String, Uri, String, T, Nullable<DateTime>)
Initializes a new instance of the Message<T> class.
public Message(string id, Uri source, string type, T data, DateTime? time = null)
Parameters
id
StringThe identifier of the message.
source
UriThe context that describes the origin of the message.
type
StringThe type that describes the type of event related to the originating occurrence.
data
TThe payload of the message.
time
Nullable<DateTime>The time at which this message was generated.
Exceptions
- System.ArgumentNullException
id
cannot be null - or -source
cannot be null - or -type
cannot be null - or -data
cannot be null.- ArgumentException
id
cannot be empty or consist only of white-space characters - or -type
cannot be empty or consist only of white-space characters - or -time
was not expressed as the Coordinated Universal Time (UTC).
Properties
Data
Gets the payload of the message.
public T Data { get; }
Property Value
- T
The payload of the message.
Id
Gets the identifier of the message. When combined with Source, this enables deduplication.
public string Id { get; }
Property Value
- String
The identifier of the message.
Source
Gets the context that describes the origin of the message. When combined with Id, this enables deduplication.
public string Source { get; }
Property Value
- String
The context that describes the origin of the message.
Time
Gets the time, expressed as the Coordinated Universal Time (UTC), at which this message was generated.
public DateTime? Time { get; }
Property Value
- Nullable<DateTime>
The time at which this message was generated.
Type
Gets the type that describes the type of event related to the originating occurrence.
public string Type { get; }
Property Value
- String
The type that describes the type of event related to the originating occurrence.