Interface IRecoverableUpdateStream<TValue>

An extension to IUpdateStream<TValue> that includes recovery functionality.

Inherited Members
IUpdateStream<TValue>.Value
IUpdateStream<TValue>.ValidateAsync()
IUpdateStream<TValue>.ValidateAsync(CancellationToken)
IUpdateStream<TValue>.SetAsync(TValue)
IUpdateStream<TValue>.SetAsync(TValue, CancellationToken)
Namespace: PushTechnology.ClientInterface.Client.Features
Assembly: Diffusion.Client.dll
Syntax
public interface IRecoverableUpdateStream<TValue> : IUpdateStream<TValue>
Type Parameters
Name Description
TValue
Remarks

A recoverable update stream wraps an IUpdateStream<TValue>, tracking topic updates and associated s.

In the event that a IRecoverableUpdateStream<TValue> returns a that completes exceptionally, calling IsRecoverable returns true then recovery is possible.

Call RecoverAsync() to re-establish the update stream and re-play incomplete topic updates before resuming.

Construct a IRecoverableUpdateStream using Build<TValue>(String, RetryStrategy)

Example feature use

This example demonstrates use of a IRecoverableUpdateStream to update topic

my/topic
. If the topic update completes exceptionally and the exception is recoverable, the code recovers - reestablishing an IUpdateStream and delivering the failed topic update.

var topicSpec = Diffusion.NewTopicSpecification(TopicType.STRING);

var stream = session.TopicUpdate .NewUpdateStreamBuilder() .Specification(topicSpec) .Build("my/topic", new RetryStrategy(1_000, 10));

try { await stream.SetAsync("some value"); } catch ( Exception ex ) { if(stream.IsRecoverable){ await stream.RecoverAsync(); } else{ throw; } }

Added in version 6.10.

Properties

IsRecoverable

Checks if recovery is possible following an exception thrown by IRecoverableUpdateStream<TValue>/>.

Declaration
bool IsRecoverable { get; }
Property Value
Type Description
System.Boolean

The recovery check.

Remarks

Must be used prior to calling RecoverAsync().

Methods

RecoverAsync()

Reestablish the inner recovery stream. Deliver pending topic updates.

Declaration
Task RecoverAsync()
Returns
Type Description
Task

A System.Threading.Tasks.Task that holds the current status of the asynchronous operation.

Remarks

If recoverable exceptions occur during recovery then pause and retry, where the pause duration and the maximum number of retries is governed by the RetryStrategy supplied to builder function Build<TValue>(String, RetryStrategy).

If non-recoverable errors occur during recovery then recovery is aborted.

If recovery fails for any reason then further recovery attempts will fail.

Exceptions
Type Condition
UpdateStreamRetryLimitException

If recovery is not possible with the limits of the retry strategy.

RecoverAsync(CancellationToken)

Reestablish the inner recovery stream. Deliver pending topic updates.

Declaration
Task RecoverAsync(CancellationToken cancellationToken)
Parameters
Type Name Description
CancellationToken cancellationToken

The cancellation token used to cancel the current operation.

Returns
Type Description
Task

A System.Threading.Tasks.Task that holds the current status of the asynchronous operation.

Remarks

If recoverable exceptions occur during recovery then pause and retry, where the pause duration and the maximum number of retries is governed by the RetryStrategy supplied to builder function Build<TValue>(String, RetryStrategy).

If non-recoverable errors occur during recovery then recovery is aborted.

If recovery fails for any reason then further recovery attempts will fail.

Exceptions
Type Condition
UpdateStreamRetryLimitException

If recovery is not possible with the limits of the retry strategy.

Back to top