Message Class

Definition

The data structure represent the message that is used for interacting with IotHub.

public sealed class Message : IDisposable
type Message = class
    interface IDisposable
    interface IReadOnlyIndicator
Public NotInheritable Class Message
Implements IDisposable
Inheritance
System.Object
Message
Implements
System.IDisposable

Constructors

Message()

Default constructor with no body data

Message(Byte[])

Constructor which uses the input byte array as the body

Message(Stream)

Constructor which uses the argument stream as the body stream.

Properties

Ack

Indicates whether consumption or expiration of the message should post data to the feedback queue

ContentEncoding

Used to specify the content encoding type of the message.

ContentType

Used to specify the content type of the message.

CorrelationId

Used in message responses and feedback

CreationTimeUtc

Custom date property set by the originator of the message.

ExpiryTimeUtc

[Optional] The time when this message is considered expired

LockToken

[Required] LockToken of the received message

MessageId

[Required for two way requests] Used to correlate two-way communication. Format: A case-sensitive string ( up to 128 char long) of ASCII 7-bit alphanumeric chars

  • {'-', ':', '/', '', '.', '+', '%', '_', '#', '*', '?', '!', '(', ')', ',', '=', '@', ';', '$', '''}. Non-alphanumeric characters are from URN RFC.
MessageSchema

Used to specify the schema of the message content.

Properties

Gets the dictionary of user properties which are set when user send the data.

To

[Required] Destination of the message

UserId

[Required in feedback messages] Used to specify the origin of messages generated by device hub. Possible value: “{hub name}/”

Methods

Clone()

Makes a clone of the current event data instance.

Dispose()

Dispose the current event data instance

GetBodyStream()

Return the body stream of the current event data instance

GetBytes()

This methods return the body stream as a byte array

Applies to