public IYieldPoint StartFlow() { return(flowProvider.YieldWithParallelRequest() .AddRequestSync <QuoteRequestMessage, QuoteResponseMessage>( new QuoteRequestMessage { Amount = 1 }, HandleFirstQuoteResponse) .AddRequestSync <QuoteRequestMessage, QuoteResponseMessage>( new QuoteRequestMessage { Amount = 2 }, HandleSecondQuoteResponse) .YieldSync(AllQuotesReceived)); }
/** * The Visualizer could've been injected through the constructor, which is * the recommended way. Just testing the injection middleware here. */ public async Task <IYieldPoint> Marco(MarcoMessage message, Visualizer myVisualizer) { Console.WriteLine(">> Marco (yielding with request)"); await myVisualizer.VisualizeMarco(); StateTestGuid = Guid.NewGuid(); return(flowProvider.YieldWithParallelRequest() .AddRequestSync <PoloConfirmationRequestMessage, PoloConfirmationResponseMessage>(new PoloConfirmationRequestMessage { StoredInState = StateTestGuid }, HandlePoloConfirmationResponse1) .AddRequestSync <PoloConfirmationRequestMessage, PoloConfirmationResponseMessage>(new PoloConfirmationRequestMessage { StoredInState = StateTestGuid }, HandlePoloConfirmationResponse2) .YieldSync(ContinuePoloConfirmation)); }