From 25c01ee1edc2e8e0b4368eb0395b5e17802b70df Mon Sep 17 00:00:00 2001 From: Mark van Renswoude Date: Thu, 15 Aug 2019 17:45:39 +0200 Subject: [PATCH] [ci skip] Fixed #14: Clarify error when yielding a parallel request builder without requests Did not implement the short-circuit to the converge method yet, as that would circumvent the controller check. Maybe later. --- Tapeti.Flow/Default/FlowProvider.cs | 3 +++ docs/flow.rst | 4 +--- docs/indepth.rst | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Tapeti.Flow/Default/FlowProvider.cs b/Tapeti.Flow/Default/FlowProvider.cs index ce66b0a..22b2ce1 100644 --- a/Tapeti.Flow/Default/FlowProvider.cs +++ b/Tapeti.Flow/Default/FlowProvider.cs @@ -290,6 +290,9 @@ namespace Tapeti.Flow.Default private IYieldPoint BuildYieldPoint(Delegate convergeMethod, bool convergeMethodSync) { + if (requests.Count == 0) + throw new YieldPointException("At least one request must be added before yielding a parallel request"); + if (convergeMethod?.Method == null) throw new ArgumentNullException(nameof(convergeMethod)); diff --git a/docs/flow.rst b/docs/flow.rst index 131e97e..d7705bd 100644 --- a/docs/flow.rst +++ b/docs/flow.rst @@ -251,12 +251,10 @@ A few things to note: #) The response handlers do not return an IYieldPoint themselves, but void (for AddRequestSync) or Task (for AddRequest). Therefore they can not influence the flow. Instead the converge method as passed to Yield or YieldSync determines how the flow continues. It is called immediately after the last response handler. #) The converge method must be private, as it is not a valid message handler in itself. - +#) You must add at least one request. Note that you do not have to perform all the operations in one go. You can store the result of ``YieldWithParallelRequest`` and conditionally call ``AddRequest`` or ``AddRequestSync`` as many times as required. -.. warning:: At the time of writing, you must add at least one request to the parallel request builder before yielding or your flow will halt. This will hopefully be fixed in the future. - Persistent state ---------------- diff --git a/docs/indepth.rst b/docs/indepth.rst index 59af570..25d6821 100644 --- a/docs/indepth.rst +++ b/docs/indepth.rst @@ -132,6 +132,7 @@ The routing key is determined by converting CamelCase to dot-separated lowercase public string Description { get; set; } } + This behaviour is implemented using the IRoutingKeyStrategy interface. For more information about changing this, see `Overriding default behaviour`_