1
0
mirror of synced 2024-07-03 09:00:36 +00:00
Tapeti/Tapeti.Flow/IFlowProvider.cs
Mark van Renswoude f8fca5879c [ci skip] Major refactoring for 2.0
- Compiles, but that's about it. Plenty of ToDo's left before it will run. Beware, ye who enter here.
- Cleanup of the internals, with the aim to keep the interface to application code compatible
- Added the ability to declare durable queues on startup and update the bindings
- Possibly fixed an issue with publish timeouts being logged after a reconnect
2019-08-13 20:30:04 +02:00

57 lines
2.3 KiB
C#

using System;
using System.Linq.Expressions;
using System.Threading.Tasks;
using Tapeti.Config;
// ReSharper disable UnusedMember.Global
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();
}
/// <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;
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;
}
/// <summary>
/// Internal interface. Do not call directly.
/// </summary>
public interface IFlowHandler
{
Task Execute(IControllerMessageContext context, IYieldPoint yieldPoint);
}
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);
IYieldPoint YieldSync(Func<IYieldPoint> continuation);
}
public interface IYieldPoint
{
}
}