private static void CreateCompetingEventMessagePumps(BusBuilderConfiguration configuration, IQueueManager queueManager, MessagingFactory messagingFactory, ICollection<IMessagePump> messagePumps) { var eventTypes = configuration.CompetingEventHandlerTypes.SelectMany(ht => ht.GetGenericInterfacesClosing(typeof (IHandleCompetingEvent<>))) .Select(gi => gi.GetGenericArguments().Single()) .OrderBy(t => t.FullName) .Distinct() .ToArray(); foreach (var eventType in eventTypes) { var applicationSharedSubscriptionName = String.Format("{0}", configuration.ApplicationName); queueManager.EnsureSubscriptionExists(eventType, applicationSharedSubscriptionName); var pump = new CompetingEventMessagePump(messagingFactory, configuration.CompetingEventBroker, eventType, applicationSharedSubscriptionName, configuration.Logger); messagePumps.Add(pump); } }
private static void CreateMulticastEventMessagePumps(BusBuilderConfiguration configuration, IQueueManager queueManager, MessagingFactory messagingFactory, ICollection<IMessagePump> messagePumps, ILogger logger) { logger.Debug("Creating multicast event message pumps"); var eventTypes = configuration.MulticastEventHandlerTypes.SelectMany(ht => ht.GetGenericInterfacesClosing(typeof (IHandleMulticastEvent<>))) .Select(gi => gi.GetGenericArguments().Single()) .OrderBy(t => t.FullName) .Distinct() .ToArray(); foreach (var eventType in eventTypes) { logger.Debug("Registering Message Pump for Event type {0}", eventType.Name); var myInstanceSubscriptionName = String.Format("{0}.{1}", configuration.InstanceName, configuration.ApplicationName); queueManager.EnsureSubscriptionExists(eventType, myInstanceSubscriptionName); var pump = new MulticastEventMessagePump(messagingFactory, configuration.MulticastEventBroker, eventType, myInstanceSubscriptionName, configuration.Logger, configuration.DefaultBatchSize); messagePumps.Add(pump); } }