다음을 통해 공유


EventGridClient.RenewCloudEventLocksAsync Method

Definition

Overloads

RenewCloudEventLocksAsync(String, String, RequestContent, RequestContext)

[Protocol Method] Renew lock for 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 renewed lockTokens, along with other failed lockTokens with their corresponding error information.

RenewCloudEventLocksAsync(String, String, RenewLockOptions, CancellationToken)

Renew lock for 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 renewed lockTokens, along with other failed lockTokens with their corresponding error information.

RenewCloudEventLocksAsync(String, String, RequestContent, RequestContext)

Source:
EventGridClient.cs

[Protocol Method] Renew lock for 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 renewed lockTokens, along with other failed lockTokens with their corresponding error information.

public virtual System.Threading.Tasks.Task<Azure.Response> RenewCloudEventLocksAsync (string topicName, string eventSubscriptionName, Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member RenewCloudEventLocksAsync : string * string * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.RenewCloudEventLocksAsync : string * string * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function RenewCloudEventLocksAsync (topicName As String, eventSubscriptionName As String, content As RequestContent, Optional context As RequestContext = Nothing) As Task(Of Response)

Parameters

topicName
String

Topic Name.

eventSubscriptionName
String

Event Subscription 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.

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 RenewCloudEventLocksAsync 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 = await client.RenewCloudEventLocksAsync("<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 RenewCloudEventLocksAsync 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 = await client.RenewCloudEventLocksAsync("<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("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

RenewCloudEventLocksAsync(String, String, RenewLockOptions, CancellationToken)

Source:
EventGridClient.cs

Renew lock for 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 renewed lockTokens, along with other failed lockTokens with their corresponding error information.

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Messaging.EventGrid.Namespaces.RenewCloudEventLocksResult>> RenewCloudEventLocksAsync (string topicName, string eventSubscriptionName, Azure.Messaging.EventGrid.Namespaces.RenewLockOptions renewLockOptions, System.Threading.CancellationToken cancellationToken = default);
abstract member RenewCloudEventLocksAsync : string * string * Azure.Messaging.EventGrid.Namespaces.RenewLockOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Messaging.EventGrid.Namespaces.RenewCloudEventLocksResult>>
override this.RenewCloudEventLocksAsync : string * string * Azure.Messaging.EventGrid.Namespaces.RenewLockOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Messaging.EventGrid.Namespaces.RenewCloudEventLocksResult>>
Public Overridable Function RenewCloudEventLocksAsync (topicName As String, eventSubscriptionName As String, renewLockOptions As RenewLockOptions, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of RenewCloudEventLocksResult))

Parameters

topicName
String

Topic Name.

eventSubscriptionName
String

Event Subscription Name.

renewLockOptions
RenewLockOptions

RenewLockOptions.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

topicName, eventSubscriptionName or renewLockOptions is null.

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

Examples

This sample shows how to call RenewCloudEventLocksAsync.

Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
EventGridClient client = new EventGridClient(endpoint, credential);

RenewLockOptions renewLockOptions = new RenewLockOptions(new string[] { "<lockTokens>" });
Response<RenewCloudEventLocksResult> response = await client.RenewCloudEventLocksAsync("<topicName>", "<eventSubscriptionName>", renewLockOptions);

This sample shows how to call RenewCloudEventLocksAsync with all parameters.

Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
EventGridClient client = new EventGridClient(endpoint, credential);

RenewLockOptions renewLockOptions = new RenewLockOptions(new string[] { "<lockTokens>" });
Response<RenewCloudEventLocksResult> response = await client.RenewCloudEventLocksAsync("<topicName>", "<eventSubscriptionName>", renewLockOptions);

Applies to