2017-01-31 11:01:08 +00:00
|
|
|
|
using System;
|
2017-02-15 21:05:01 +00:00
|
|
|
|
using System.Linq.Expressions;
|
2017-01-31 11:01:08 +00:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Tapeti.Config;
|
|
|
|
|
|
2018-12-19 19:50:56 +00:00
|
|
|
|
// ReSharper disable UnusedMember.Global
|
|
|
|
|
|
2017-01-31 11:01:08 +00:00
|
|
|
|
namespace Tapeti.Flow
|
|
|
|
|
{
|
|
|
|
|
public interface IFlowProvider
|
|
|
|
|
{
|
|
|
|
|
IYieldPoint YieldWithRequest<TRequest, TResponse>(TRequest message, Func<TResponse, Task<IYieldPoint>> 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, TResponse>(TRequest message, Func<TResponse, IYieldPoint> responseHandler);
|
|
|
|
|
|
|
|
|
|
IFlowParallelRequestBuilder YieldWithParallelRequest();
|
|
|
|
|
|
|
|
|
|
IYieldPoint EndWithResponse<TResponse>(TResponse message);
|
|
|
|
|
IYieldPoint End();
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-15 21:05:01 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Allows starting a flow outside of a message handler.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public interface IFlowStarter
|
|
|
|
|
{
|
|
|
|
|
Task Start<TController>(Expression<Func<TController, Func<IYieldPoint>>> methodSelector) where TController : class;
|
|
|
|
|
Task Start<TController>(Expression<Func<TController, Func<Task<IYieldPoint>>>> methodSelector) where TController : class;
|
2017-09-22 09:19:49 +00:00
|
|
|
|
Task Start<TController, TParameter>(Expression<Func<TController, Func<TParameter, IYieldPoint>>> methodSelector, TParameter parameter) where TController : class;
|
|
|
|
|
Task Start<TController, TParameter>(Expression<Func<TController, Func<TParameter, Task<IYieldPoint>>>> methodSelector, TParameter parameter) where TController : class;
|
2017-02-15 21:05:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Internal interface. Do not call directly.
|
|
|
|
|
/// </summary>
|
2017-01-31 11:01:08 +00:00
|
|
|
|
public interface IFlowHandler
|
|
|
|
|
{
|
2019-08-13 18:30:04 +00:00
|
|
|
|
Task Execute(IControllerMessageContext context, IYieldPoint yieldPoint);
|
2017-01-31 11:01:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public interface IFlowParallelRequestBuilder
|
|
|
|
|
{
|
|
|
|
|
IFlowParallelRequestBuilder AddRequest<TRequest, TResponse>(TRequest message, Func<TResponse, Task> responseHandler);
|
|
|
|
|
IFlowParallelRequestBuilder AddRequestSync<TRequest, TResponse>(TRequest message, Action<TResponse> responseHandler);
|
|
|
|
|
|
|
|
|
|
IYieldPoint Yield(Func<Task<IYieldPoint>> continuation);
|
2017-02-12 18:04:26 +00:00
|
|
|
|
IYieldPoint YieldSync(Func<IYieldPoint> continuation);
|
2017-01-31 11:01:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public interface IYieldPoint
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|