コード例 #1
0
ファイル: Startup.cs プロジェクト: dfds/capability-service
        private void ConfigureDomainEvents(IServiceCollection services)
        {
            var eventRegistry = new DomainEventRegistry();

            services.AddSingleton <IDomainEventRegistry>(eventRegistry);


            services.AddSingleton(eventRegistry);
            services.AddTransient <EventHandlerFactory>();
            services.AddTransient <IEventHandler <AWSContextAccountCreatedIntegrationEvent>, AWSContextAccountCreatedEventHandler>();
            services.AddTransient <IEventDispatcher, EventDispatcher>();

            var capabilitiesTopicName       = Configuration["CAPABILITY_SERVICE_KAFKA_TOPIC_CAPABILITY"];
            var capabilitiesTopicsTopicName = Configuration["CAPABILITY_SERVICE_KAFKA_TOPIC_TOPICS"];

            eventRegistry
            .Register <CapabilityCreated>("capability_created", capabilitiesTopicName)
            .Register <CapabilityUpdated>("capability_updated", capabilitiesTopicName)
            .Register <CapabilityDeleted>("capability_deleted", capabilitiesTopicName)
            .Register <MemberJoinedCapability>("member_joined_capability", capabilitiesTopicName)
            .Register <MemberLeftCapability>("member_left_capability", capabilitiesTopicName)
            .Register <ContextAddedToCapability>("context_added_to_capability", capabilitiesTopicName)
            .Register <ContextUpdated>("context_updated", capabilitiesTopicName)
            .Register <AWSContextAccountCreatedIntegrationEvent>("aws_context_account_created",
                                                                 capabilitiesTopicName)
            .Register <TopicCreated>("topic_created", capabilitiesTopicsTopicName)
            .Register <ClusterCreated>("cluster_created", capabilitiesTopicsTopicName);
            var scanner = new DomainEventScanner(eventRegistry);

            scanner.EnsureNoUnregisteredDomainEventsIn(Assembly.GetExecutingAssembly());
        }
コード例 #2
0
ファイル: Startup.cs プロジェクト: lulzzz/capability-service
        private static void ConfigureDomainEvents(IServiceCollection services)
        {
            var eventRegistry = new DomainEventRegistry();

            services.AddSingleton <IDomainEventRegistry>(eventRegistry);
            services.AddTransient <KafkaPublisherFactory.KafkaConfiguration>();
            services.AddTransient <KafkaPublisherFactory>();
            services.AddHostedService <PublishingService>();

            var capabilitiesTopicName = "build.capabilities";

            eventRegistry
            .Register <CapabilityCreated>("capability_created", capabilitiesTopicName)
            .Register <MemberJoinedCapability>("member_joined_capability", capabilitiesTopicName)
            .Register <MemberLeftCapability>("member_left_capability", capabilitiesTopicName)
            .Register <ContextAddedToCapability>("context_added_to_capability", capabilitiesTopicName);

            var scanner = new DomainEventScanner(eventRegistry);

            scanner.EnsureNoUnregisteredDomainEventsIn(Assembly.GetExecutingAssembly());
        }