Interface IMessage
Represents a message either to be sent to a message broker or received from a message broker.
Namespace: CodersRealm.AmqpClient
Assembly: CodersRealm.AmqpClient.dll
Syntax
public interface IMessage
Properties
CorrelationID
The correlation ID used to correlate messages from conversations or long running business processes.
Declaration
string CorrelationID { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
DeliveryMode
Whether or not this message is persistent.
Declaration
MsgDeliveryMode DeliveryMode { get; set; }
Property Value
| Type | Description |
|---|---|
| MsgDeliveryMode |
DeliveryTime
When a message is sent, the DeliveryTime header field is left unassigned. After completion of the send or publish method, it holds the delivery time of the message. This is the the difference, measured in milliseconds, between the delivery time and midnight, January 1, 1970 UTC.
A message's delivery time is the earliest time when a JMS provider may deliver the message to a consumer. The provider must not deliver messages before the delivery time has been reached.
Declaration
DateTime DeliveryTime { get; set; }
Property Value
| Type | Description |
|---|---|
| DateTime |
Destination
The destination of the message. This property is set by the IMessageProducer.
Declaration
IDestination? Destination { get; set; }
Property Value
| Type | Description |
|---|---|
| IDestination |
MessageId
The message ID which is set by the provider.
Declaration
string MessageId { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Priority
The Priority of this message.
Declaration
MsgPriority Priority { get; set; }
Property Value
| Type | Description |
|---|---|
| MsgPriority |
Properties
Provides access to the message properties (headers).
Declaration
IPrimitiveMap Properties { get; }
Property Value
| Type | Description |
|---|---|
| IPrimitiveMap |
Redelivered
Returns true if this message has been redelivered to this or another consumer before being acknowledged successfully.
Declaration
bool Redelivered { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
ReplyTo
The destination that the consumer of this message should send replies to
Declaration
IDestination? ReplyTo { get; set; }
Property Value
| Type | Description |
|---|---|
| IDestination |
TimeToLive
The amount of time for which this message is valid. Zero if this message does not expire.
Declaration
TimeSpan TimeToLive { get; set; }
Property Value
| Type | Description |
|---|---|
| TimeSpan |
Timestamp
The timestamp of when the message was pubished in UTC time. If the publisher disables setting the timestamp on the message, the time will be set to the start of the UNIX epoc (1970-01-01 00:00:00).
Declaration
DateTime Timestamp { get; set; }
Property Value
| Type | Description |
|---|---|
| DateTime |
Type
The type name of this message.
Declaration
string Type { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
Acknowledge()
If using client acknowledgement mode on the session, then this method will acknowledge that the message has been processed correctly.
Declaration
void Acknowledge()
AcknowledgeAsync()
If using client acknowledgement mode on the session, then this method will acknowledge that the message has been processed correctly.
Declaration
Task AcknowledgeAsync()
Returns
| Type | Description |
|---|---|
| Task |
Body<T>()
The message body as a byte array.
Declaration
T Body<T>()
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| T |
ClearBody()
Clears out the message body. Clearing a message's body does not clear its header values or property entries.
If this message body was read-only, calling this method leaves the message body in the same state as an empty body in a newly created message.
Declaration
void ClearBody()
ClearProperties()
Clears a message's properties.
The message's header fields and body are not cleared.
Declaration
void ClearProperties()
IsBodyAssignableTo(Type)
Determines whether the message body can be assigned to the specified type.
Declaration
bool IsBodyAssignableTo(Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type | The type to check against the message body. |
Returns
| Type | Description |
|---|---|
| bool | True if the message body can be assigned to the specified type; otherwise, false. |