Bagikan melalui


DigitalTwinsClient.PublishComponentTelemetry Method

Definition

Publishes telemetry from a digital twin's component synchronously. The result is then consumed by one or many destination endpoints (subscribers) defined under DigitalTwinsEventRoute. These event routes need to be set before publishing a telemetry message, in order for the telemetry message to be consumed.

public virtual Azure.Response PublishComponentTelemetry (string digitalTwinId, string componentName, string messageId, string payload, DateTimeOffset? timestamp = default, System.Threading.CancellationToken cancellationToken = default);
abstract member PublishComponentTelemetry : string * string * string * string * Nullable<DateTimeOffset> * System.Threading.CancellationToken -> Azure.Response
override this.PublishComponentTelemetry : string * string * string * string * Nullable<DateTimeOffset> * System.Threading.CancellationToken -> Azure.Response
Public Overridable Function PublishComponentTelemetry (digitalTwinId As String, componentName As String, messageId As String, payload As String, Optional timestamp As Nullable(Of DateTimeOffset) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Response

Parameters

digitalTwinId
String

The Id of the digital twin.

componentName
String

The name of the DTDL component.

messageId
String

A unique message identifier (within the scope of the digital twin id) that is commonly used for de-duplicating messages. Defaults to a random GUID if argument is null.

payload
String

The application/json telemetry payload to be sent.

timestamp
Nullable<DateTimeOffset>

An RFC 3339 timestamp that identifies the time the telemetry was measured. It defaults to the current date/time UTC.

cancellationToken
CancellationToken

The cancellation token.

Returns

The HTTP response Response.

Exceptions

The exception that captures the errors from the service. Check the ErrorCode and Status properties for more details.

The exception is thrown when digitalTwinId or componentName or payload is null.

Remarks

For more samples, see our repo samples.

Applies to

See also