IReliableQueue<T>.TryPeekAsync Method

Definition

Overloads

TryPeekAsync(ITransaction)

Tries to return an object from the beginning of the reliable queue without removing it.

TryPeekAsync(ITransaction, LockMode)

Tries to return an object from the beginning of the reliable queue without removing it.

TryPeekAsync(ITransaction, TimeSpan, CancellationToken)

Tries to return an object from the beginning of the reliable queue without removing it.

TryPeekAsync(ITransaction, LockMode, TimeSpan, CancellationToken)

Tries to return an object from the beginning of the reliable queue without removing it.

TryPeekAsync(ITransaction)

Tries to return an object from the beginning of the reliable queue without removing it.

public System.Threading.Tasks.Task<Microsoft.ServiceFabric.Data.ConditionalValue<T>> TryPeekAsync (Microsoft.ServiceFabric.Data.ITransaction tx);
abstract member TryPeekAsync : Microsoft.ServiceFabric.Data.ITransaction -> System.Threading.Tasks.Task<Microsoft.ServiceFabric.Data.ConditionalValue<'T>>
Public Function TryPeekAsync (tx As ITransaction) As Task(Of ConditionalValue(Of T))

Parameters

tx
ITransaction

Transaction to associate this operation with.

Returns

System.Threading.Tasks.Task<ConditionalValue<T>>

Task that represents the asynchronous peek operation. The task result is a tuple indicating whether an object was found at the beginning of the queue and if so, the object.

Exceptions

System.ArgumentNullException

tx is null.

System.TimeoutException

The operation failed to complete within the default timeout.

Exception indicates that the cannot serve reads at the moment. can be thrown in all s. One example for it being thrown in the is loss of . One example for it being thrown in the is that Reliable Queue's state is not yet consistent.

The transaction has been internally faulted by the system. Retry the operation on a new transaction

System.InvalidOperationException

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.

Applies to

TryPeekAsync(ITransaction, LockMode)

Tries to return an object from the beginning of the reliable queue without removing it.

public System.Threading.Tasks.Task<Microsoft.ServiceFabric.Data.ConditionalValue<T>> TryPeekAsync (Microsoft.ServiceFabric.Data.ITransaction tx, Microsoft.ServiceFabric.Data.Collections.LockMode lockMode);
abstract member TryPeekAsync : Microsoft.ServiceFabric.Data.ITransaction * Microsoft.ServiceFabric.Data.Collections.LockMode -> System.Threading.Tasks.Task<Microsoft.ServiceFabric.Data.ConditionalValue<'T>>

Parameters

tx
ITransaction

Transaction to associate this operation with.

lockMode
LockMode

Type of locking to use for this read operation.

Returns

System.Threading.Tasks.Task<ConditionalValue<T>>

Task that represents the asynchronous peek operation. The task result is a tuple indicating whether an object was found at the beginning of the queue and if so, the object.

Exceptions

System.ArgumentNullException

tx is null.

System.TimeoutException

The operation failed to complete within the default timeout.

Exception indicates that the cannot serve reads at the moment. can be thrown in all s. One example for it being thrown in the is loss of . One example for it being thrown in the is that Reliable Queue's state is not yet consistent.

The transaction has been internally faulted by the system. Retry the operation on a new transaction

System.InvalidOperationException

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.

Applies to

TryPeekAsync(ITransaction, TimeSpan, CancellationToken)

Tries to return an object from the beginning of the reliable queue without removing it.

public System.Threading.Tasks.Task<Microsoft.ServiceFabric.Data.ConditionalValue<T>> TryPeekAsync (Microsoft.ServiceFabric.Data.ITransaction tx, TimeSpan timeout, System.Threading.CancellationToken cancellationToken);
abstract member TryPeekAsync : Microsoft.ServiceFabric.Data.ITransaction * TimeSpan * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.ServiceFabric.Data.ConditionalValue<'T>>

Parameters

tx
ITransaction

Transaction to associate this operation with.

timeout
System.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
System.Threading.CancellationToken

The token to monitor for cancellation requests. The default is None.

Returns

System.Threading.Tasks.Task<ConditionalValue<T>>

Task that represents the asynchronous peek operation. The task result is a tuple indicating whether an object was found at the beginning of the queue and if so, the object.

Exceptions

System.ArgumentNullException

tx is null.

System.ArgumentException

timeout is negative.

System.TimeoutException

The operation failed to complete within the given timeout.

System.OperationCanceledException

The operation was canceled.

Exception indicates that the cannot serve reads at the moment. can be thrown in all s. One example for it being thrown in the is loss of . One example for it being thrown in the is that Reliable Queue's state is not yet consistent.

The transaction has been internally faulted by the system. Retry the operation on a new transaction

System.InvalidOperationException

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.

Applies to

TryPeekAsync(ITransaction, LockMode, TimeSpan, CancellationToken)

Tries to return an object from the beginning of the reliable queue without removing it.

public System.Threading.Tasks.Task<Microsoft.ServiceFabric.Data.ConditionalValue<T>> TryPeekAsync (Microsoft.ServiceFabric.Data.ITransaction tx, Microsoft.ServiceFabric.Data.Collections.LockMode lockMode, TimeSpan timeout, System.Threading.CancellationToken cancellationToken);
abstract member TryPeekAsync : Microsoft.ServiceFabric.Data.ITransaction * Microsoft.ServiceFabric.Data.Collections.LockMode * TimeSpan * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.ServiceFabric.Data.ConditionalValue<'T>>

Parameters

tx
ITransaction

Transaction to associate this operation with.

lockMode
LockMode

Type of locking to use for this read operation.

timeout
System.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
System.Threading.CancellationToken

The token to monitor for cancellation requests. The default is None.

Returns

System.Threading.Tasks.Task<ConditionalValue<T>>

Task that represents the asynchronous peek operation. The task result is a tuple indicating whether an object was found at the beginning of the queue and if so, the object.

Exceptions

System.ArgumentNullException

tx is null.

System.ArgumentException

timeout is negative.

System.TimeoutException

The operation failed to complete within the given timeout.

System.OperationCanceledException

The operation was canceled.

Exception indicates that the cannot serve reads at the moment. can be thrown in all s. One example for it being thrown in the is loss of . One example for it being thrown in the is that Reliable Queue's state is not yet consistent.

The transaction has been internally faulted by the system. Retry the operation on a new transaction

System.InvalidOperationException

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.

Applies to