Table of Contents

Method GetRequiredAsync

Namespace
MVVrus.AspNetCore.ActiveSession.StdRunner
Assembly
MVVrus.AspNetCore.ActiveSession.dll

GetRequiredAsync(int, CancellationToken, int, string?)

Asynchronously fetch result from the runner up to the specified point.

public ValueTask<RunnerResult<TResult>> GetRequiredAsync(int Advance = 0, CancellationToken Token = default, int StartPosition = -1, string? TraceIdentifier = null)

Parameters

Advance int

Desired maximum increment of the runner's Position, at which the fetch should stop. Interpretaion of the default parameter value DEFAULT_ADVANCE depends on a type of the runner.

Token CancellationToken

A CancellationToken that may be used to cancel the returned ValueTask. Cancellation typically does not affect a background runner execution.

StartPosition int

Position value from which a fetch of the result should begin. In general, value of this parameter should be non-negative (except for the special value below) and not less than value of the Position property. Use CURRENT_POSITION constant to continue to fetch result from the last position fetched.

TraceIdentifier string
String that can be used for tracing.

Returns

ValueTask<RunnerResult<TResult>>
A ValueTask that has a result of type RunnerResult<TResult>. Fields in the structure returned as a result contains values of the properties Status and Position at the point of completion in fields with the same names and a runner-specific result in a Result field,

Remarks

If Advance has zero (i.e. DEFAULT_ADVANCE) value and StartPosition has (explicitly or implicitly, using CURRENT_POSITION) the same value as the current Position property then value of the Advance is assumed to be 1.

This method always returns a result (value of Result field in the RunnerResult structure) obtained from the last callback from the background process (or its returned result if the background process has been ended and returns a result). So when the method is called for the earlier resulting position than achieved by the background process it does return not an intermediate result for that position but the last result for the current position achieved by background.