1
0
mirror of synced 2024-11-05 02:59:16 +00:00
Tapeti/Tapeti.Transient/TransientMiddleware.cs
Menno van Lavieren 6bc6cfe216 MAX-911 RDB Relaties samenvoegen vanuit LEF en update ontvangen in LEF
MAX-1081 POC Dictionary tasks in Web voor request
Setup voor Transient request response met TODO's
2019-04-24 18:04:30 +02:00

34 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using Tapeti.Config;
namespace Tapeti.Transient
{
public class TransientMiddleware : ITapetiExtension, ITapetiExtentionBinding
{
private string dynamicQueuePrefix;
private TimeSpan defaultTimeout;
public TransientMiddleware(TimeSpan defaultTimeout, string dynamicQueuePrefix)
{
this.dynamicQueuePrefix = dynamicQueuePrefix;
this.defaultTimeout = defaultTimeout;
}
public void RegisterDefaults(IDependencyContainer container)
{
container.RegisterDefaultSingleton(() => new TransientRouter(container.Resolve<IInternalPublisher>(), defaultTimeout));
container.RegisterDefault<ITransientPublisher, TransientPublisher>();
}
public IEnumerable<object> GetMiddleware(IDependencyResolver dependencyResolver)
{
return new object[0];
}
public IEnumerable<ICustomBinding> GetBindings(IDependencyResolver dependencyResolver)
{
yield return new TransientGenericBinding(dependencyResolver.Resolve<TransientRouter>(), dynamicQueuePrefix);
}
}
}