Class FlowStreamWatch

Namespace
Kuestenlogik.Bowire.Flows
Assembly
Kuestenlogik.Bowire.Flows.dll

#1050 — a stream a flow step watches: subscribed before the step's call, asked after it whether the expected frames arrived. bowire test and the workbench (through /api/flows/stream-watch) both use it, so a stream expectation reads the same in both.

Where the plugin implements IBowireStreamSubscriber, StartAsync(string, string, string, string?, Dictionary<string, string>?, CancellationToken) returns once the subscription is in place and a frame the step causes cannot be missed. Otherwise the stream is opened through InvokeStreamAsync(string, string, string, List<string>, bool, Dictionary<string, string>?, CancellationToken), which cannot say when it took hold; Confirmed is false and a failing result says so.

public sealed class FlowStreamWatch : IAsyncDisposable
Inheritance
FlowStreamWatch
Implements
Inherited Members

Constructors

FlowStreamWatch(IBowireProtocol)

public FlowStreamWatch(IBowireProtocol protocol)

Parameters

protocol IBowireProtocol

Fields

DefaultTimeout

The wait when a stream expectation names none.

public static readonly TimeSpan DefaultTimeout

Field Value

TimeSpan

Properties

Confirmed

Whether the plugin confirmed the subscription before StartAsync(string, string, string, string?, Dictionary<string, string>?, CancellationToken) returned.

public bool Confirmed { get; }

Property Value

bool

Method

The stream method, for messages.

public string Method { get; }

Property Value

string

ProtocolId

The stream's protocol id, for messages.

public string ProtocolId { get; }

Property Value

string

Methods

AwaitAsync(FlowStreamExpectation, TimeSpan, CancellationToken)

Wait until the frames expectation asks for arrived, the stream ended, or timeout passed, and say which. The wait ends on the frame that completes the expectation, not on a clock.

public Task<FlowExpectationResult> AwaitAsync(FlowStreamExpectation expectation, TimeSpan timeout, CancellationToken ct = default)

Parameters

expectation FlowStreamExpectation
timeout TimeSpan
ct CancellationToken

Returns

Task<FlowExpectationResult>

DisposeAsync()

public ValueTask DisposeAsync()

Returns

ValueTask

StartAsync(string, string, string, string?, Dictionary<string, string>?, CancellationToken)

Subscribe to the stream. Returns once the subscription is in place where the plugin can say so; a failure to subscribe throws.

public Task StartAsync(string serverUrl, string service, string method, string? body, Dictionary<string, string>? metadata, CancellationToken ct = default)

Parameters

serverUrl string
service string
method string
body string
metadata Dictionary<string, string>
ct CancellationToken

Returns

Task

TimeoutOf(FlowStreamExpectation, string?)

The wait a stream expectation asks for, or the configured default.

public static TimeSpan TimeoutOf(FlowStreamExpectation expectation, string? configuredMs)

Parameters

expectation FlowStreamExpectation
configuredMs string

Returns

TimeSpan