Struct Message<T>
Represents a message that can be published to a data stream.
Namespace: Microsoft.Psi
Assembly: Microsoft.Psi.dll
Syntax
public struct Message<T>
Type Parameters
Name | Description |
---|---|
T | The payload of the message. |
Constructors
View SourceMessage(T, DateTime, DateTime, Int32, Int32)
Initializes a new instance of the Message<T> struct.
Declaration
public Message(T data, DateTime originatingTime, DateTime time, int sourceId, int sequenceId)
Parameters
Type | Name | Description |
---|---|---|
T | data | The data to time-stamp. |
DateTime | originatingTime | The time of the real-world event that led to the creation of this message. |
DateTime | time | The time of this message. |
System.Int32 | sourceId | The source id of this message. |
System.Int32 | sequenceId | The sequence id of this message. |
Properties
View SourceCreationTime
Gets the time when the message was created and posted.
Declaration
public readonly DateTime CreationTime { get; }
Property Value
Type | Description |
---|---|
DateTime |
Data
Gets the payload of the message.
Declaration
public T Data { get; }
Property Value
Type | Description |
---|---|
T |
OriginatingTime
Gets the time when the source message was created.
Declaration
public readonly DateTime OriginatingTime { get; }
Property Value
Type | Description |
---|---|
DateTime |
SequenceId
Gets the sequence id of the message in the data stream.
Declaration
public readonly int SequenceId { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
SourceId
Gets the ID of the stream that created the message.
Declaration
public readonly int SourceId { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
View SourceEquals(Object)
Determines whether two instances are equal.
Declaration
public override bool Equals(object other)
Parameters
Type | Name | Description |
---|---|---|
Object | other | The object to compare to. |
Returns
Type | Description |
---|---|
System.Boolean | True if the instances are equal. |
GetHashCode()
Returns a hash code for this instance, obtained by combining the hash codes of the instance fields.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A hashcode. |
ToString()
Provide a string representation of this Timestamped instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | Payload preceded by originating time. |
Operators
View SourceEquality(Message<T>, Message<T>)
Determines whether two instances are equal.
Declaration
public static bool operator ==(Message<T> first, Message<T> second)
Parameters
Type | Name | Description |
---|---|---|
Message<T> | first | The first object to compare. |
Message<T> | second | The object to compare to. |
Returns
Type | Description |
---|---|
System.Boolean | True if the instances are equal. |
Inequality(Message<T>, Message<T>)
Determines whether two instances are equal.
Declaration
public static bool operator !=(Message<T> first, Message<T> second)
Parameters
Type | Name | Description |
---|---|---|
Message<T> | first | The first object to compare. |
Message<T> | second | The object to compare to. |
Returns
Type | Description |
---|---|
System.Boolean | True if the instances are equal. |