Share via


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

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

tx is null.

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

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>>
Public Function TryPeekAsync (tx As ITransaction, lockMode As LockMode) As Task(Of ConditionalValue(Of T))

Parameters

tx
ITransaction

Transaction to associate this operation with.

lockMode
LockMode

Type of locking to use for this read operation.

Returns

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

tx is null.

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

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>>
Public Function TryPeekAsync (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 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

tx is null.

timeout is negative.

The operation failed to complete within the given timeout.

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

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>>
Public Function TryPeekAsync (tx As ITransaction, lockMode As LockMode, timeout As TimeSpan, cancellationToken As CancellationToken) As Task(Of ConditionalValue(Of T))

Parameters

tx
ITransaction

Transaction to associate this operation with.

lockMode
LockMode

Type of locking to use for this read operation.

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 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

tx is null.

timeout is negative.

The operation failed to complete within the given timeout.

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

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