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)
A watch on a stream of protocol; StartAsync(string, string, string, string?, Dictionary<string, string>?, CancellationToken) subscribes.
public FlowStreamWatch(IBowireProtocol protocol)
Parameters
protocolIBowireProtocol
Fields
DefaultTimeout
The wait when a stream expectation names none.
public static readonly TimeSpan DefaultTimeout
Field Value
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
Method
The stream method, for messages.
public string Method { get; }
Property Value
ProtocolId
The stream's protocol id, for messages.
public string ProtocolId { get; }
Property Value
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
expectationFlowStreamExpectationtimeoutTimeSpanctCancellationToken
Returns
DisposeAsync()
public ValueTask DisposeAsync()
Returns
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
serverUrlstringservicestringmethodstringbodystringmetadataDictionary<string, string>ctCancellationToken
Returns
TimeoutOf(FlowStreamExpectation, string?)
The wait a stream expectation asks for, or the configured default.
public static TimeSpan TimeoutOf(FlowStreamExpectation expectation, string? configuredMs)
Parameters
expectationFlowStreamExpectationconfiguredMsstring