Table of Contents

Class CloudEvent

Namespace
Azure.Iot.Operations.Protocol
Assembly
Azure.Iot.Operations.Protocol.dll

Implements the CloudEvent spec 1.0. The required fields are source, type, id and specversion. Id is required but we want to update it in the same instance. See CloudEvent Spec

public class CloudEvent
Inheritance
CloudEvent
Derived
Inherited Members

Constructors

CloudEvent(Uri, string, string)

Implements the CloudEvent spec 1.0. The required fields are source, type, id and specversion. Id is required but we want to update it in the same instance. See CloudEvent Spec

public CloudEvent(Uri source, string type = "", string specversion = "1.0")

Parameters

source Uri

Source

type string

Type

specversion string

SpecVersion

Properties

DataSchema

Identifies the schema that data adheres to. Incompatible changes to the schema SHOULD be reflected by a different URI.

public string? DataSchema { get; set; }

Property Value

string

Remarks

This value must resolve to a valid URI.

Id

Identifies the event. Producers MUST ensure that source + id is unique for each distinct event. If a duplicate event is re-sent (e.g. due to a network error) it MAY have the same id. Consumers MAY assume that Events with identical source and id are duplicates.

public string? Id { get; set; }

Property Value

string

Source

Identifies the context in which an event happened. Often this will include information such as the type of the event source, the organization publishing the event or the process that produced the event. The exact syntax and semantics behind the data encoded in the URI is defined by the event producer.

public Uri Source { get; }

Property Value

Uri

SpecVersion

The version of the CloudEvents specification which the event uses. This enables the interpretation of the context. Compliant event producers MUST use a value of 1.0 when referring to this version of the specification.

public string SpecVersion { get; set; }

Property Value

string

Subject

Identifies the subject of the event in the context of the event producer (identified by source). In publish-subscribe scenarios, a subscriber will typically subscribe to events emitted by a source, but the source identifier alone might not be sufficient as a qualifier for any specific event if the source context has internal sub-structure.

public string? Subject { get; set; }

Property Value

string

Remarks

This value can be set to null if no subject should be sent.

When this cloud event is sent by a telemetry sender/command invoker/command executor, a default value of the MQTT topic this event is sent on will be filled in for you if no other value is explicitly set.

Time

Timestamp of when the occurrence happened. If the time of the occurrence cannot be determined then this attribute MAY be set to some other time (such as the current time) by the CloudEvents producer, however all producers for the same source MUST be consistent in this respect.

public DateTime? Time { get; set; }

Property Value

DateTime?

Remarks

By default, this value is set to the current UTC time. This field can be set to null if you don't want the cloud event to include a time.

Type

Contains a value describing the type of event related to the originating occurrence. Often this attribute is used for routing, observability, policy enforcement, etc. The format of this is producer defined and might include information such as the version of the type

public string Type { get; set; }

Property Value

string

Remarks

This value cannot be null or whitespace