using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using StellaOps.Messaging.Abstractions;
using StellaOps.Messaging.Plugins;
namespace StellaOps.Messaging.Transport.Valkey;
///
/// Valkey/Redis transport plugin for StellaOps.Messaging.
///
public sealed class ValkeyTransportPlugin : IMessagingTransportPlugin
{
///
public string Name => "valkey";
///
public bool IsAvailable(IServiceProvider services) => true;
///
public void Register(MessagingTransportRegistrationContext context)
{
// Register options
context.Services.AddOptions()
.Bind(context.GetTransportConfiguration())
.ValidateDataAnnotations()
.ValidateOnStart();
// Register connection factory
context.Services.AddSingleton();
// Register message queue factory
context.Services.AddSingleton();
// Register cache factory
context.Services.AddSingleton();
// Register rate limiter factory
context.Services.AddSingleton();
// Register atomic token store factory
context.Services.AddSingleton();
// Register sorted index factory
context.Services.AddSingleton();
// Register set store factory
context.Services.AddSingleton();
// Register event stream factory
context.Services.AddSingleton();
// Register idempotency store factory
context.Services.AddSingleton();
context.LoggerFactory?.CreateLogger()
.LogDebug("Registered Valkey transport plugin");
}
}