Message Class

Represents a message to or from IoTHub

Initializer for Message

Inheritance
builtins.object
Message

Constructor

Message(data, message_id=None, content_encoding=None, content_type=None, output_name=None)

Parameters

Name Description
data
Required

The data that constitutes the payload

message_id
str

A user-settable identifier for the message used for request-reply patterns. Format: A case-sensitive string (up to 128 characters long) of ASCII 7-bit alphanumeric characters + {'-', ':', '.', '+', '%', '_', '#', '*', '?', '!', '(', ')', ',', '=', '@', ';', '$', '''}

Default value: None
content_encoding
str

Content encoding of the message data. Other values can be utf-16' or 'utf-32'

Default value: None
content_type
str

Content type property used to routes with the message body.

Default value: None
output_name
str

Name of the output that the is being sent to.

Default value: None

Variables

Name Description
data

The data that constitutes the payload

custom_properties

Dictionary of custom message properties. The keys and values of these properties will always be string.

id
<xref:message>

A user-settable identifier for the message used for request-reply patterns. Format: A case-sensitive string (up to 128 characters long) of ASCII 7-bit alphanumeric characters + {'-', ':', '.', '+', '%', '_', '#', '*', '?', '!', '(', ')', ',', '=', '@', ';', '$', '''}

expiry_time_utc

Date and time of message expiration in UTC format

correlation_id

A property in a response message that typically contains the message_id of the request, in request-reply patterns

user_id

An ID to specify the origin of messages

content_encoding

Content encoding of the message data. Can be 'utf-8', 'utf-16' or 'utf-32'

content_type

Content type property used to route messages with the message-body. Can be 'application/json'

output_name

Name of the output that the message is being sent to.

input_name

Name of the input that the message was received on.

Methods

get_size
set_as_security_message

Set the message as a security message.

This is a provisional API. Functionality not yet guaranteed.

get_size

get_size()

set_as_security_message

Set the message as a security message.

This is a provisional API. Functionality not yet guaranteed.

set_as_security_message()

Attributes

iothub_interface_id