EventGridClient.ReleaseCloudEvents Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
ReleaseCloudEvents(String, String, RequestContent, Nullable<Int32>, RequestContext) |
[Protocol Method] Release batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully released lockTokens, along with other failed lockTokens with their corresponding error information.
|
ReleaseCloudEvents(String, String, ReleaseOptions, Nullable<ReleaseDelay>, CancellationToken) |
Release batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully released lockTokens, along with other failed lockTokens with their corresponding error information. |
ReleaseCloudEvents(String, String, RequestContent, Nullable<Int32>, RequestContext)
- Source:
- EventGridClient.cs
[Protocol Method] Release batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully released lockTokens, along with other failed lockTokens with their corresponding error information.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler ReleaseCloudEvents(String, String, ReleaseOptions, Nullable<ReleaseDelay>, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.Response ReleaseCloudEvents (string topicName, string eventSubscriptionName, Azure.Core.RequestContent content, int? releaseDelayInSeconds = default, Azure.RequestContext context = default);
abstract member ReleaseCloudEvents : string * string * Azure.Core.RequestContent * Nullable<int> * Azure.RequestContext -> Azure.Response
override this.ReleaseCloudEvents : string * string * Azure.Core.RequestContent * Nullable<int> * Azure.RequestContext -> Azure.Response
Public Overridable Function ReleaseCloudEvents (topicName As String, eventSubscriptionName As String, content As RequestContent, Optional releaseDelayInSeconds As Nullable(Of Integer) = Nothing, Optional context As RequestContext = Nothing) As Response
Parameters
- topicName
- String
Topic Name.
- eventSubscriptionName
- String
Event Subscription Name.
- content
- RequestContent
The content to send as the body of the request.
Release cloud events with the specified delay in seconds. Allowed values: "0" | "10" | "60" | "600" | "3600".
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The response returned from the service.
Exceptions
topicName
, eventSubscriptionName
or content
is null.
topicName
or eventSubscriptionName
is an empty string, and was expected to be non-empty.
Service returned a non-success status code.
Examples
This sample shows how to call ReleaseCloudEvents and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
EventGridClient client = new EventGridClient(endpoint, credential);
using RequestContent content = RequestContent.Create(new
{
lockTokens = new object[]
{
"<lockTokens>"
},
});
Response response = client.ReleaseCloudEvents("<topicName>", "<eventSubscriptionName>", content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("failedLockTokens")[0].GetProperty("lockToken").ToString());
Console.WriteLine(result.GetProperty("failedLockTokens")[0].GetProperty("error").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("failedLockTokens")[0].GetProperty("error").GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("succeededLockTokens")[0].ToString());
This sample shows how to call ReleaseCloudEvents with all parameters and request content and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
EventGridClient client = new EventGridClient(endpoint, credential);
using RequestContent content = RequestContent.Create(new
{
lockTokens = new object[]
{
"<lockTokens>"
},
});
Response response = client.ReleaseCloudEvents("<topicName>", "<eventSubscriptionName>", content, releaseDelayInSeconds: 0);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("failedLockTokens")[0].GetProperty("lockToken").ToString());
Console.WriteLine(result.GetProperty("failedLockTokens")[0].GetProperty("error").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("failedLockTokens")[0].GetProperty("error").GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("failedLockTokens")[0].GetProperty("error").GetProperty("target").ToString());
Console.WriteLine(result.GetProperty("failedLockTokens")[0].GetProperty("error").GetProperty("innererror").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("succeededLockTokens")[0].ToString());
Applies to
ReleaseCloudEvents(String, String, ReleaseOptions, Nullable<ReleaseDelay>, CancellationToken)
- Source:
- EventGridClient.cs
Release batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully released lockTokens, along with other failed lockTokens with their corresponding error information.
public virtual Azure.Response<Azure.Messaging.EventGrid.Namespaces.ReleaseResult> ReleaseCloudEvents (string topicName, string eventSubscriptionName, Azure.Messaging.EventGrid.Namespaces.ReleaseOptions releaseOptions, Azure.Messaging.EventGrid.Namespaces.ReleaseDelay? releaseDelayInSeconds = default, System.Threading.CancellationToken cancellationToken = default);
abstract member ReleaseCloudEvents : string * string * Azure.Messaging.EventGrid.Namespaces.ReleaseOptions * Nullable<Azure.Messaging.EventGrid.Namespaces.ReleaseDelay> * System.Threading.CancellationToken -> Azure.Response<Azure.Messaging.EventGrid.Namespaces.ReleaseResult>
override this.ReleaseCloudEvents : string * string * Azure.Messaging.EventGrid.Namespaces.ReleaseOptions * Nullable<Azure.Messaging.EventGrid.Namespaces.ReleaseDelay> * System.Threading.CancellationToken -> Azure.Response<Azure.Messaging.EventGrid.Namespaces.ReleaseResult>
Public Overridable Function ReleaseCloudEvents (topicName As String, eventSubscriptionName As String, releaseOptions As ReleaseOptions, Optional releaseDelayInSeconds As Nullable(Of ReleaseDelay) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Response(Of ReleaseResult)
Parameters
- topicName
- String
Topic Name.
- eventSubscriptionName
- String
Event Subscription Name.
- releaseOptions
- ReleaseOptions
ReleaseOptions.
- releaseDelayInSeconds
- Nullable<ReleaseDelay>
Release cloud events with the specified delay in seconds.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
topicName
, eventSubscriptionName
or releaseOptions
is null.
topicName
or eventSubscriptionName
is an empty string, and was expected to be non-empty.
Examples
This sample shows how to call ReleaseCloudEvents.
Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
EventGridClient client = new EventGridClient(endpoint, credential);
ReleaseOptions releaseOptions = new ReleaseOptions(new string[] { "<lockTokens>" });
Response<ReleaseResult> response = client.ReleaseCloudEvents("<topicName>", "<eventSubscriptionName>", releaseOptions);
This sample shows how to call ReleaseCloudEvents with all parameters.
Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
EventGridClient client = new EventGridClient(endpoint, credential);
ReleaseOptions releaseOptions = new ReleaseOptions(new string[] { "<lockTokens>" });
Response<ReleaseResult> response = client.ReleaseCloudEvents("<topicName>", "<eventSubscriptionName>", releaseOptions, releaseDelayInSeconds: ReleaseDelay.By0Seconds);
Applies to
Azure SDK for .NET