Table of Contents

Class CommandRequestMetadata

Namespace
Azure.Iot.Operations.Protocol.RPC
Assembly
Azure.Iot.Operations.Protocol.dll
public class CommandRequestMetadata
Inheritance
CommandRequestMetadata
Inherited Members

Constructors

CommandRequestMetadata()

Construct CommandRequestMetadata in user code, for passing to a command invocation.

public CommandRequestMetadata()

Remarks

  • The CorrelationData field will be set to a new GUID; if the CommandRequestMetadata is passed to a command invocation, this value will be used as the correlation date for the request.
  • The InvokerClientId field will be set to null; user code can obtain the MQTT client ID directly from the MQTT client.
  • The Timestamp field will be set to the current ApplicationContext's HybridLogicalClock time for the process.
  • The FencingToken field will be initialized to null; this can be set by user code if desired.
  • The UserData field will be initialized with an empty dictionary; entries in this dictionary can be set by user code as desired.

Properties

CloudEvent

The cloud event to apply to an outgoing command invocation.

public CloudEvent? CloudEvent { get; set; }

Property Value

CloudEvent

Remarks

For getting the full cloud event from a received command on the executor side, use ExtendedCloudEvent.

ContentType

The content type of a command received by a command executor if a content type was provided on the MQTT message.

public string? ContentType { get; }

Property Value

string

Remarks

This field is only set by the command executor when deserializing a request. It cannot be used by a command invoker to change the content type of a command request.

CorrelationId

The correlation data used to connect a command response to a command request. When CommandRequestMetadata is constructed by user code that will invoke a command, the CorrelationData is set to a new GUID. When CommandRequestMetadata is passed by a CommandExecutor into a user-code execution function, the Correlation Data is set from the request message.

public Guid CorrelationId { get; }

Property Value

Guid

ExtendedCloudEvent

The full received cloud event as received by a command executor.

public ExtendedCloudEvent? ExtendedCloudEvent { get; }

Property Value

ExtendedCloudEvent

Remarks

For setting cloud events on an outgoing command, use CloudEvent instead.

InvokerClientId

The MQTT Client ID of the Command invoker that sends the request. This property has no meaning to user code that will invoke a command; the InvokerClientId is set to null on construction. When CommandRequestMetadata is passed by a CommandExecutor into a user-code execution function, the InvokerClientId is set from the request message.

public string? InvokerClientId { get; }

Property Value

string

Partition

The partition attached to the request. When CommandRequestMetadata is constructed by user code that will invoke a command, the partition is initialized to null, and it can be set by user code. When CommandRequestMetadata is passed by a CommandExecutor into a user-code execution function, the partition is set from the request message; this will be null if the message contains no partition header.

public string? Partition { get; }

Property Value

string

PayloadFormatIndicator

The payload format indicator of a command received by a command executor.

public MqttPayloadFormatIndicator PayloadFormatIndicator { get; }

Property Value

MqttPayloadFormatIndicator

Remarks

This field is only set by the command executor when deserializing a request. It cannot be used by a command invoker to change the payload format indicator of a command request.

Timestamp

The timestamp attached to the request. When CommandRequestMetadata is constructed by user code that will invoke a command, the Timestamp is set from the updated HybridLogicalClock of the CommandInvoker. When CommandRequestMetadata is passed by a CommandExecutor into a user-code execution function, the Timestamp is set from the request message; this will be null if the message contains no timestamp header.

public HybridLogicalClock? Timestamp { get; }

Property Value

HybridLogicalClock

TopicTokens

A dictionary of MQTT topic tokens and the replacement values extracted from the publication topic.

public Dictionary<string, string> TopicTokens { get; }

Property Value

Dictionary<string, string>

UserData

A dictionary of user properties that are sent along with the request from the CommandInvoker to the CommandExecutor. When CommandRequestMetadata is constructed by user code that will invoke a command, the UserData is initialized with an empty dictionary. When CommandRequestMetadata is passed by a CommandExecutor into a user-code execution function, the UserData is set from the request message.

public Dictionary<string, string> UserData { get; }

Property Value

Dictionary<string, string>