コード例 #1
0
        public void Initialize(IServiceBus bus)
        {
            if (ServiceBusConfiguration.ServiceBusSection == null || ServiceBusConfiguration.ServiceBusSection.ForwardingRoutes == null)
            {
                return;
            }

            var factory = new MessageRouteSpecificationFactory();

            foreach (MessageRouteElement mapElement in ServiceBusConfiguration.ServiceBusSection.ForwardingRoutes)
            {
                var map = messageRoutes.Find(mapElement.Uri);

                if (map == null)
                {
                    map = new MessageRoute(bus.Configuration.QueueManager.GetQueue(mapElement.Uri));

                    messageRoutes.Add(map);
                }

                foreach (SpecificationElement specificationElement in mapElement)
                {
                    map.AddSpecification(factory.Create(specificationElement.Name, specificationElement.Value));
                }
            }
        }
コード例 #2
0
        public void Initialize(IServiceBus bus)
        {
            if (ServiceBusConfiguration.ServiceBusSection == null || ServiceBusConfiguration.ServiceBusSection.ForwardingRoutes == null)
            {
                return;
            }

            var factory = new MessageRouteSpecificationFactory();

            foreach (MessageRouteElement mapElement in ServiceBusConfiguration.ServiceBusSection.ForwardingRoutes)
            {
                var map = messageRoutes.Find(mapElement.Uri);

                if (map == null)
                {
                    map = new MessageRoute(QueueManager.Instance.GetQueue(mapElement.Uri));

                    messageRoutes.Add(map);
                }

                foreach (SpecificationElement specificationElement in mapElement)
                {
                    map.AddSpecification(factory.Create(specificationElement.Name, specificationElement.Value));
                }
            }
        }
コード例 #3
0
ファイル: MessageRouteTest.cs プロジェクト: hopla/shuttle-esb
        public void Should_be_able_to_create_a_new_route()
        {
            IMessageRoute map = new MessageRoute(new MemoryQueue(new Uri("memory://.")));

            map.AddSpecification(new RegexMessageRouteSpecification("simple"));

            Assert.IsFalse(map.IsSatisfiedBy(new OtherNamespaceCommand().GetType().FullName));
            Assert.IsTrue(map.IsSatisfiedBy(new SimpleCommand().GetType().FullName));
        }
コード例 #4
0
        public void Should_be_able_to_create_new_routes()
        {
            var queue = new MemoryQueue(new Uri("memory://."));
            var route = new MessageRoute(queue);
            var routes = new MessageRouteCollection();

            route.AddSpecification(new RegexMessageRouteSpecification("simple"));

            routes.Add(route);

            Assert.AreSame(queue, routes.FindAll(new SimpleCommand())[0].Queue);
        }