using System; using System.Linq.Expressions; using System.Threading.Tasks; using Tapeti.Config; namespace Tapeti.Flow { public interface IFlowProvider { IYieldPoint YieldWithRequest(TRequest message, Func> responseHandler); // One does not simply overload methods with Task vs non-Task Funcs. "Ambiguous call". // Apparantly this is because a return type of a method is not part of its signature, // according to: http://stackoverflow.com/questions/18715979/ambiguity-with-action-and-func-parameter IYieldPoint YieldWithRequestSync(TRequest message, Func responseHandler); IFlowParallelRequestBuilder YieldWithParallelRequest(); IYieldPoint EndWithResponse(TResponse message); IYieldPoint End(); } /// /// Allows starting a flow outside of a message handler. /// public interface IFlowStarter { Task Start(Expression>> methodSelector) where TController : class; Task Start(Expression>>> methodSelector) where TController : class; } /// /// Internal interface. Do not call directly. /// public interface IFlowHandler { Task Execute(IMessageContext context, IYieldPoint yieldPoint); } public interface IFlowParallelRequestBuilder { IFlowParallelRequestBuilder AddRequest(TRequest message, Func responseHandler); IFlowParallelRequestBuilder AddRequestSync(TRequest message, Action responseHandler); IYieldPoint Yield(Func> continuation); IYieldPoint YieldSync(Func continuation); } public interface IYieldPoint { } }