Message

Message

A message contains the actual data object which is sent by the publisher and delivered to the interested subscribers for the topic.


Constructor

# new Message(payload, timeSpan)

Initializes an instance of Message.

Parameters:
Name Type Default Description
payload JSON null

The actual data object of interest for subscribers, for example, Order.

timeSpan TimeSpan null

ExpirationTime of TimeSpan type after which the message is expired from the topic. This can also accept null value, which will ensure that the message is not expired from the topic. In case of no expiration time specified, null is considered as default.

Methods

# (static) getNoExpiration() → {TimeSpan}

Get specifies TimeSpan.MaxValue for the message, so that it is not expired.

Returns:
Type
TimeSpan

# getCreationTime() → {Date}

Get creation time in DateTime for the message.

Returns:
Type
Date

# getExpirationTime() → {TimeSpan}

Get ExpirationTime of TimeSpan type after which the message is expired from the topic. This can also accept null value, which will ensure that the message is not expired from the topic. In case of no expiration time specified, null is considered as default.

Returns:
Type
TimeSpan

# getMessageId() → {string}

Get auto generated ID for the message, as same messages can be stored on different topics.

Returns:
Type
string

# getPayload() → {json}

The actual data object of interest for subscribers, for example, Order.

Returns:
Type
json

# setCreationTime(value)

Set creation time in Date for the message.

Parameters:
Name Type Description
value Date

creation time in Date

# setExpirationTime(value)

Set ExpirationTime of TimeSpan type after which the message is expired from the topic. This can also accept null value, which will ensure that the message is not expired from the topic. In case of no expiration time specified, null is considered as default.

Parameters:
Name Type Description
value TimeSpan

ExpirationTime of TimeSpan

# setMessageId(value)

Set auto generated ID for the message, as same messages can be stored on different topics.

Parameters:
Name Type Description
value string

Auto generated ID for the message, as same messages can be stored on different topics.