Esempio n. 1
0
        private static void CreateMulticastRequestMessagePumps(BusBuilderConfiguration configuration,
                                                               QueueManager queueManager,
                                                               MessagingFactory messagingFactory,
                                                               List<IMessagePump> messagePumps)
        {
            var requestTypes = configuration.RequestHandlerTypes.SelectMany(ht => ht.GetGenericInterfacesClosing(typeof (IHandleRequest<,>)))
                                            .Select(gi => gi.GetGenericArguments().First())
                                            .OrderBy(t => t.FullName)
                                            .Distinct()
                                            .ToArray();

            foreach (var requestType in requestTypes)
            {
                var applicationSharedSubscriptionName = String.Format("{0}", configuration.ApplicationName);
                queueManager.EnsureSubscriptionExists(requestType, applicationSharedSubscriptionName);

                var pump = new MulticastRequestMessagePump(messagingFactory,
                                                           configuration.MulticastRequestBroker,
                                                           requestType,
                                                           applicationSharedSubscriptionName,
                                                           configuration.Logger);
                messagePumps.Add(pump);
            }
        }