using Microsoft.AspNetCore.Builder; namespace MaksIT.Dapr.Extensions; /// /// ASP.NET Core pipeline helpers for Dapr pub/sub and actors. /// public static class WebApplicationExtensions { /// /// This code should be placed after the middleware that configures authentication /// and authorization but before any other middleware that needs to process incoming HTTP requests. /// This ensures that the UseCloudEvents and MapSubscribeHandler middleware has access to the raw HTTP request data /// before it is processed by other middleware. /// /// If you need to set controller as subscriber, use [Topic("pubsubName", "name")] attribute /// where: /// /// /// pubsubName /// The name of the pubsub component to use. /// /// /// name /// The topic name. /// /// /// /// /// The application builder. public static void RegisterSubscriber(this WebApplication app) { app.UseCloudEvents(); app.MapSubscribeHandler(); } /// /// Maps Dapr actor HTTP handlers. Call after /// (typically near endpoint mapping; avoid HTTPS redirection before actors in development sidecars). /// /// The application builder. public static void RegisterActorsHandlers(this WebApplication app) => app.MapActorsHandlers(); }