38 lines
1.3 KiB
C#
38 lines
1.3 KiB
C#
using Microsoft.Extensions.DependencyInjection;
|
|
using Svrnty.CQRS.Events.Abstractions.Notifications;
|
|
using Svrnty.CQRS.Events.Abstractions.Delivery;
|
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
|
using Svrnty.CQRS.Events.Abstractions;
|
|
|
|
namespace Svrnty.CQRS.Events.Grpc;
|
|
|
|
/// <summary>
|
|
/// Service collection extensions for gRPC event streaming.
|
|
/// </summary>
|
|
public static class ServiceCollectionExtensions
|
|
{
|
|
/// <summary>
|
|
/// Add gRPC event streaming support.
|
|
/// Requires Grpc.AspNetCore to be configured in the application.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// <strong>Phase 1.7:</strong>
|
|
/// Registers the gRPC event delivery provider for push-based streaming.
|
|
/// </para>
|
|
/// </remarks>
|
|
public static IServiceCollection AddSvrntyEventsGrpc(this IServiceCollection services)
|
|
{
|
|
// EventServiceImpl is registered as a singleton so we can access the static notification method
|
|
services.AddSingleton<EventServiceImpl>();
|
|
|
|
// Register the gRPC event notifier (legacy)
|
|
services.TryAddSingleton<IEventNotifier, GrpcEventNotifier>();
|
|
|
|
// Phase 1.7: Register gRPC event delivery provider
|
|
services.TryAddSingleton<IEventDeliveryProvider, GrpcEventDeliveryProvider>();
|
|
|
|
return services;
|
|
}
|
|
}
|