IReliableQueue<T>.TryDequeueAsync 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
TryDequeueAsync(ITransaction) |
Tries to remove and return the object at the beginning of the reliable queue. |
TryDequeueAsync(ITransaction, TimeSpan, CancellationToken) |
Tries to remove and return the object at the beginning of the reliable queue. |
TryDequeueAsync(ITransaction)
Tries to remove and return the object at the beginning of the reliable queue.
public System.Threading.Tasks.Task<Microsoft.ServiceFabric.Data.ConditionalValue<T>> TryDequeueAsync (Microsoft.ServiceFabric.Data.ITransaction tx);
abstract member TryDequeueAsync : Microsoft.ServiceFabric.Data.ITransaction -> System.Threading.Tasks.Task<Microsoft.ServiceFabric.Data.ConditionalValue<'T>>
Public Function TryDequeueAsync (tx As ITransaction) As Task(Of ConditionalValue(Of T))
Parameters
- tx
- ITransaction
Transaction to associate this operation with.
Returns
Task that represents the asynchronous dequeue operation. The task result is a tuple indicating whether an object was removed and if so, the object.
Exceptions
tx
is null.
The operation failed to complete within the default timeout.
The exception that is thrown when the is not in .
The transaction has been internally faulted by the system. Retry the operation on a new transaction
Thrown when a method call is invalid for the object's current state. Example, transaction used is already terminated: committed or aborted by the user. If this exception is thrown, it is highly likely that there is a bug in the service code of the use of transactions.
Remarks
If a retriable exception is thrown by this method, it is recommended to dispose the transaction tx
and try again with a new transaction.
Applies to
TryDequeueAsync(ITransaction, TimeSpan, CancellationToken)
Tries to remove and return the object at the beginning of the reliable queue.
public System.Threading.Tasks.Task<Microsoft.ServiceFabric.Data.ConditionalValue<T>> TryDequeueAsync (Microsoft.ServiceFabric.Data.ITransaction tx, TimeSpan timeout, System.Threading.CancellationToken cancellationToken);
abstract member TryDequeueAsync : Microsoft.ServiceFabric.Data.ITransaction * TimeSpan * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.ServiceFabric.Data.ConditionalValue<'T>>
Public Function TryDequeueAsync (tx As ITransaction, timeout As TimeSpan, cancellationToken As CancellationToken) As Task(Of ConditionalValue(Of T))
Parameters
- tx
- ITransaction
Transaction to associate this operation with.
- timeout
- TimeSpan
The amount of time to wait for the operation to complete before throwing a TimeoutException. Primarily used to prevent deadlocks. The default is 4 seconds.
- cancellationToken
- CancellationToken
The token to monitor for cancellation requests. The default is None.
Returns
Task that represents the asynchronous dequeue operation. The task result is a tuple indicating whether an object was removed and if so, the object.
Exceptions
tx
is null.
timeout
is negative.
The operation failed to complete within the given timeout.
The operation was canceled.
The exception that is thrown when the is not in .
The transaction has been internally faulted by the system. Retry the operation on a new transaction
Thrown when a method call is invalid for the object's current state. Example, transaction used is already terminated: committed or aborted by the user. If this exception is thrown, it is highly likely that there is a bug in the service code of the use of transactions.
Remarks
If a retriable exception is thrown by this method, it is recommended to dispose the transaction tx
and try again with a new transaction.
Applies to
Azure SDK for .NET