Delen via


CloudEvent Constructors

Definition

Overloads

CloudEvent(String, String, Object, Type)

Initializes a new instance of the CloudEvent class.

CloudEvent(String, String, BinaryData, String, CloudEventDataFormat)

Initializes a new instance of the CloudEvent class using binary event data.

CloudEvent(String, String, Object, Type)

Source:
CloudEvent.cs

Initializes a new instance of the CloudEvent class.

public CloudEvent (string source, string type, object? jsonSerializableData, Type? dataSerializationType = default);
new Azure.Messaging.CloudEvent : string * string * obj * Type -> Azure.Messaging.CloudEvent
Public Sub New (source As String, type As String, jsonSerializableData As Object, Optional dataSerializationType As Type = Nothing)

Parameters

source
String

Identifies the context in which an event happened. The combination of id and source must be unique for each distinct event.

type
String

Type of event related to the originating occurrence. For example, "Contoso.Items.ItemReceived".

jsonSerializableData
Object

Event data specific to the event type.

dataSerializationType
Type

The type to use when serializing the data. If not specified, GetType() will be used on jsonSerializableData.

Exceptions

source or type was null.

Applies to

CloudEvent(String, String, BinaryData, String, CloudEventDataFormat)

Source:
CloudEvent.cs

Initializes a new instance of the CloudEvent class using binary event data.

public CloudEvent (string source, string type, BinaryData? data, string? dataContentType, Azure.Messaging.CloudEventDataFormat dataFormat = Azure.Messaging.CloudEventDataFormat.Binary);
new Azure.Messaging.CloudEvent : string * string * BinaryData * string * Azure.Messaging.CloudEventDataFormat -> Azure.Messaging.CloudEvent
Public Sub New (source As String, type As String, data As BinaryData, dataContentType As String, Optional dataFormat As CloudEventDataFormat = Azure.Messaging.CloudEventDataFormat.Binary)

Parameters

source
String

Identifies the context in which an event happened. The combination of id and source must be unique for each distinct event.

type
String

Type of event related to the originating occurrence. For example, "Contoso.Items.ItemReceived".

data
BinaryData

Binary event data specific to the event type.

dataContentType
String

Content type of the payload. A content type different from "application/json" should be specified if payload is not JSON.

dataFormat
CloudEventDataFormat

The format that the data of a CloudEvent should be sent in when using the JSON envelope format.

Exceptions

source or type was null.

Applies to