1
0
mirror of synced 2024-11-22 09:13:51 +00:00
Tapeti/Tapeti.Transient/TransientExtension.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

43 lines
1.2 KiB
C#

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);
}
}
}