1
0
mirror of synced 2024-09-27 19:46:07 +00:00
Tapeti/Tapeti.Flow/FlowMiddleware.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

31 lines
1006 B
C#

using System.Collections.Generic;
using Tapeti.Config;
using Tapeti.Flow.Default;
namespace Tapeti.Flow
{
public class FlowMiddleware : ITapetiExtension
{
private readonly IFlowRepository flowRepository;
public FlowMiddleware(IFlowRepository flowRepository)
{
this.flowRepository = flowRepository;
}
public void RegisterDefaults(IDependencyContainer container)
{
container.RegisterDefault<IFlowProvider, FlowProvider>();
container.RegisterDefault<IFlowStarter, FlowStarter>();
container.RegisterDefault<IFlowHandler, FlowProvider>();
container.RegisterDefaultSingleton(() => flowRepository ?? new NonPersistentFlowRepository());
container.RegisterDefaultSingleton<IFlowStore, FlowStore>();
}
public IEnumerable<object> GetMiddleware(IDependencyResolver dependencyResolver)
{
yield return new FlowBindingMiddleware();
}
}
}