355c992dbf
Flow ruimt nu zijn locks goed op en de weggeschreven state ingeval van exceptions tijdens het afhandelen van de message
32 lines
1.0 KiB
C#
32 lines
1.0 KiB
C#
using System.Collections.Generic;
|
|
using Tapeti.Config;
|
|
using Tapeti.Flow.Default;
|
|
|
|
namespace Tapeti.Flow
|
|
{
|
|
public class FlowMiddleware : ITapetiExtension
|
|
{
|
|
private 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.RegisterDefault<IFlowRepository>(() => flowRepository ?? new NonPersistentFlowRepository());
|
|
container.RegisterDefault<IFlowStore, FlowStore>();
|
|
}
|
|
|
|
public IEnumerable<object> GetMiddleware(IDependencyResolver dependencyResolver)
|
|
{
|
|
yield return new FlowBindingMiddleware();
|
|
yield return new FlowCleanupMiddleware();
|
|
}
|
|
}
|
|
}
|