TransactionalBatch.ExecuteAsync Method

Definition

Overloads

ExecuteAsync(CancellationToken)

Executes the transactional batch at the Azure Cosmos service as an asynchronous operation.

ExecuteAsync(TransactionalBatchRequestOptions, CancellationToken)

Executes the transactional batch at the Azure Cosmos service as an asynchronous operation.

ExecuteAsync(CancellationToken)

Source:
TransactionalBatch.cs

Executes the transactional batch at the Azure Cosmos service as an asynchronous operation.

public abstract System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.TransactionalBatchResponse> ExecuteAsync (System.Threading.CancellationToken cancellationToken = default);
abstract member ExecuteAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.TransactionalBatchResponse>
Public MustOverride Function ExecuteAsync (Optional cancellationToken As CancellationToken = Nothing) As Task(Of TransactionalBatchResponse)

Parameters

cancellationToken
CancellationToken

(Optional) Cancellation token representing request cancellation.

Returns

An awaitable response which contains details of execution of the transactional batch.

If the transactional batch executes successfully, the StatusCode on the response returned will be set to OK.

If an operation within the transactional batch fails during execution, no changes from the batch will be committed and the status of the failing operation is made available in the StatusCode. To get more details about the operation that failed, the response can be enumerated - this returns TransactionalBatchOperationResult instances corresponding to each operation in the transactional batch in the order they were added into the transactional batch. For a result corresponding to an operation within the transactional batch, the StatusCode indicates the status of the operation - if the operation was not executed or it was aborted due to the failure of another operation within the transactional batch, the value of this field will be HTTP 424 (Failed Dependency); for the operation that caused the batch to abort, the value of this field will indicate the cause of failure as a HTTP status code.

The StatusCode on the response returned may also have values such as HTTP 5xx in case of server errors and HTTP 429 (Too Many Requests).

Remarks

This API only throws on client side exceptions. This is to increase performance and prevent the overhead of throwing exceptions. Use IsSuccessStatusCode on the response returned to ensure that the transactional batch succeeded. Limits on TransactionalBatch requests

Applies to

ExecuteAsync(TransactionalBatchRequestOptions, CancellationToken)

Source:
TransactionalBatch.cs

Executes the transactional batch at the Azure Cosmos service as an asynchronous operation.

public abstract System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.TransactionalBatchResponse> ExecuteAsync (Microsoft.Azure.Cosmos.TransactionalBatchRequestOptions requestOptions, System.Threading.CancellationToken cancellationToken = default);
abstract member ExecuteAsync : Microsoft.Azure.Cosmos.TransactionalBatchRequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.TransactionalBatchResponse>
Public MustOverride Function ExecuteAsync (requestOptions As TransactionalBatchRequestOptions, Optional cancellationToken As CancellationToken = Nothing) As Task(Of TransactionalBatchResponse)

Parameters

requestOptions
TransactionalBatchRequestOptions

Options that apply specifically to batch request.

cancellationToken
CancellationToken

(Optional) Cancellation token representing request cancellation.

Returns

An awaitable response which contains details of execution of the transactional batch.

If the transactional batch executes successfully, the StatusCode on the response returned will be set to OK.

If an operation within the transactional batch fails during execution, no changes from the batch will be committed and the status of the failing operation is made available in the StatusCode. To get more details about the operation that failed, the response can be enumerated - this returns TransactionalBatchOperationResult instances corresponding to each operation in the transactional batch in the order they were added into the transactional batch. For a result corresponding to an operation within the transactional batch, the StatusCode indicates the status of the operation - if the operation was not executed or it was aborted due to the failure of another operation within the transactional batch, the value of this field will be HTTP 424 (Failed Dependency); for the operation that caused the batch to abort, the value of this field will indicate the cause of failure as a HTTP status code.

The StatusCode on the response returned may also have values such as HTTP 5xx in case of server errors and HTTP 429 (Too Many Requests).

Remarks

This API only throws on client side exceptions. This is to increase performance and prevent the overhead of throwing exceptions. Use IsSuccessStatusCode on the response returned to ensure that the transactional batch succeeded. Limits on TransactionalBatch requests

Applies to