1
0
mirror of synced 2024-11-22 01:13:49 +00:00
Tapeti/Tapeti.Transient/TransientExtension.cs

43 lines
1.2 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using Tapeti.Config;
namespace Tapeti.Transient
{
/// <inheritdoc cref="ITapetiExtension" />
public class TransientExtension : ITapetiExtensionBinding
{
private readonly string dynamicQueuePrefix;
private readonly TransientRouter router;
/// <inheritdoc />
public TransientExtension(TimeSpan defaultTimeout, string dynamicQueuePrefix)
{
this.dynamicQueuePrefix = dynamicQueuePrefix;
router = new TransientRouter(defaultTimeout);
}
/// <inheritdoc />
public void RegisterDefaults(IDependencyContainer container)
{
container.RegisterDefaultSingleton(router);
container.RegisterDefault<ITransientPublisher, TransientPublisher>();
}
/// <inheritdoc />
public IEnumerable<object> GetMiddleware(IDependencyResolver dependencyResolver)
{
return null;
}
/// <inheritdoc />
public IEnumerable<IBinding> GetBindings(IDependencyResolver dependencyResolver)
{
yield return new TransientGenericBinding(router, dynamicQueuePrefix);
}
}
}