Share via


EventGridClient.PublishCloudEventAsync Method

Definition

Overloads

PublishCloudEventAsync(String, RequestContent, RequestContext)

[Protocol Method] Publish Single Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for internal server error.

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
PublishCloudEventAsync(String, CloudEvent, Boolean, CancellationToken)

Publish Single Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for internal server error.

PublishCloudEventAsync(String, RequestContent, RequestContext)

Source:
EventGridClient.cs

[Protocol Method] Publish Single Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for internal server error.

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual System.Threading.Tasks.Task<Azure.Response> PublishCloudEventAsync (string topicName, Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member PublishCloudEventAsync : string * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.PublishCloudEventAsync : string * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function PublishCloudEventAsync (topicName As String, content As RequestContent, Optional context As RequestContext = Nothing) As Task(Of Response)

Parameters

topicName
String

Topic Name.

content
RequestContent

The content to send as the body of the request.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Exceptions

topicName or content is null.

topicName is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Applies to

PublishCloudEventAsync(String, CloudEvent, Boolean, CancellationToken)

Source:
EventGridClient.cs

Publish Single Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for internal server error.

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Messaging.EventGrid.Namespaces.PublishResult>> PublishCloudEventAsync (string topicName, Azure.Messaging.CloudEvent event, bool binaryMode = false, System.Threading.CancellationToken cancellationToken = default);
abstract member PublishCloudEventAsync : string * Azure.Messaging.CloudEvent * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Messaging.EventGrid.Namespaces.PublishResult>>
override this.PublishCloudEventAsync : string * Azure.Messaging.CloudEvent * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Messaging.EventGrid.Namespaces.PublishResult>>
Public Overridable Function PublishCloudEventAsync (topicName As String, event As CloudEvent, Optional binaryMode As Boolean = false, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of PublishResult))

Parameters

topicName
String

Topic Name.

cloudEvent
CloudEvent
binaryMode
Boolean
cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

topicName or cloudEvent is null.

topicName is an empty string, and was expected to be non-empty.

Applies to