Beispiel #1
0
        private static void RegisterAssemblyDomainEventSubscriptionMappings(DomainEventBusConfig domainEventBusConfig, IEnumerable <Type> domainEventTypes, ICollection <Type> domainEventMessageTypes, UnicastBus bus)
        {
            var domainEventMessageType = typeof(DomainEventMessage <>);

            foreach (DomainEventEndpointMapping mapping in domainEventBusConfig.DomainEventEndpointMappings)
            {
                foreach (var domainEventType in domainEventTypes)
                {
                    if (DomainEventsIsAssembly(domainEventType, mapping.DomainEvents))
                    {
                        var messageType = domainEventMessageType.MakeGenericType(domainEventType);
                        domainEventMessageTypes.Add(messageType);
                        bus.RegisterMessageType(messageType, new Address(mapping.QueueName, mapping.MachineName));
                    }
                }
            }
        }
        private static void RegisterDomainEventSubscriptionMappings(DomainEventBusConfig domainEventBusConfig, IEnumerable <Type> domainEventTypes, ICollection <Type> domainEventMessageTypes, UnicastBus bus)
        {
            var domainEventMessageType = typeof(DomainEventMessage <>);

            foreach (DomainEventEndpointMapping mapping in domainEventBusConfig.DomainEventEndpointMappings)
            {
                foreach (var domainEventType in domainEventTypes)
                {
                    if (DomainEventsIsDomainEvent(domainEventType, mapping.DomainEvents))
                    {
                        var messageType = domainEventMessageType.MakeGenericType(domainEventType);
                        domainEventMessageTypes.Add(messageType);
                        bus.RegisterMessageType(messageType, mapping.Endpoint, false);
                    }
                }
            }
        }