Exemple #1
0
        public RoutingInfo GetRoutingInfo(IDictionary<string, string> routingHints)
        {
            string topic = routingHints.GetMessageTopic();

            Exchange theOneExchange = new Exchange(
                this.Name,
                this.Hostname,
                this.VirtualHost,
                this.Port,
                topic,
                string.Format("{0}#{1}", this.ClientProfile, topic),
                "direct",
                false,
                true);

            RouteInfo theOneRoute = new RouteInfo(theOneExchange, theOneExchange);

            return new RoutingInfo(new RouteInfo[] { theOneRoute });
        }
Exemple #2
0
        public RoutingInfo GetRoutingInfo(IDictionary <string, string> routingHints)
        {
            string topic = routingHints.GetMessageTopic();

            Exchange theOneExchange = new Exchange(
                this.Name,
                this.Hostname,
                this.VirtualHost,
                this.Port,
                topic,
                string.Format("{0}#{1}", this.ClientProfile, topic),
                "direct",
                false,
                true);

            RouteInfo theOneRoute = new RouteInfo(theOneExchange, theOneExchange);

            return(new RoutingInfo(new RouteInfo[] { theOneRoute }));
        }
        public RoutingInfo GetFallbackRoute(string topic)
        {
            // either use the given named queue, or build one dynamically
            string oneQueueToRuleThemAll = this.QueueName ?? string.Format(
                "{0}#{1}#{2}", this.ClientName, ++UniqueProcessId, topic);

            // there's only one exchange
            Exchange oneExchangeToFindThem = new Exchange(
                    this.ExchangeName, this.Hostname, this.VHost,
                    this.Port, topic, oneQueueToRuleThemAll, this.ExchangeType,
                    this.IsDurable, this.IsAutoDelete, this.Arguments);

            // for both producing and consuming
            RouteInfo oneRouteToBringThemAll = new RouteInfo(oneExchangeToFindThem, oneExchangeToFindThem);

            // make a list out of the one route
            List<RouteInfo> andInTheDarknessBindThem = new RouteInfo[] { oneRouteToBringThemAll }.ToList();

            // and create routing info from it
            return new RoutingInfo(andInTheDarknessBindThem);
        }