public RabbitMqMessageSpecificTopicListeningAgent(RabbitMqEndpoint endpoint, HandlerGraph handlers,
                                                          TransportUri transportUri, ITransportLogger logger, JasperOptions settings)
        {
            Address = endpoint.Uri.ToUri();

            var endpoints = endpoint.SpreadForMessageSpecificTopics(handlers.ValidMessageTypeNames());

            foreach (var topicEndpoint in endpoints)
            {
                topicEndpoint.Connect();
                var agent = topicEndpoint.CreateListeningAgent(transportUri.ToUri(), settings, logger);
                _inner.Add(agent);
            }
        }
예제 #2
0
        public RabbitMqEndpoint[] SpreadForMessageSpecificTopics(string[] topicNames)
        {
            if (!Uri.IsMessageSpecificTopic())
            {
                throw new InvalidOperationException($"{TransportUri.ToUri()} is not a message specific topic Uri");
            }


            return(topicNames.Select(topic =>
            {
                var uri = TransportUri.CloneForTopic(topic);
                var endpoint = new RabbitMqEndpoint(uri, Protocol, ConnectionFactory, ExchangeName, ExchangeType);
                endpoint.AmqpTcpEndpoints.AddRange(AmqpTcpEndpoints);

                return endpoint;
            }).ToArray());
        }
예제 #3
0
        protected override IListeningAgent buildListeningAgent(TransportUri transportUri, RabbitMqEndpoint endpoint,
                                                               JasperOptions settings, HandlerGraph handlers)
        {
            if (endpoint == null)
            {
                throw new ArgumentOutOfRangeException(nameof(transportUri), $"Could not resolve a Rabbit MQ endpoint for the Uri '{transportUri}'");
            }

            if (transportUri.IsMessageSpecificTopic())
            {
                return(new RabbitMqMessageSpecificTopicListeningAgent(endpoint, handlers, transportUri, logger, settings));
            }
            else
            {
                endpoint.Connect();
                return(endpoint.CreateListeningAgent(transportUri.ToUri(), settings, logger));
            }
        }
예제 #4
0
        public void write_uri_with_routingkey()
        {
            var uri = new TransportUri("rabbitmq", "conn1", true, routingKey: "routing1");

            uri.ToUri().ShouldBe(new Uri("rabbitmq://conn1/durable/routingkey/routing1"));
        }
예제 #5
0
        public void write_uri_with_subscription()
        {
            var uri = new TransportUri("azureservicebus", "conn1", true, subscriptionName: "one");

            uri.ToUri().ShouldBe(new Uri("azureservicebus://conn1/durable/subscription/one"));
        }
예제 #6
0
        public void generate_uri(string uriString, string protocol, string connectionName, string queue, string topic, bool durable)
        {
            var uri = new TransportUri(protocol, connectionName, durable, queueName: queue, topicName: topic);

            uri.ToUri().ShouldBe(uriString.ToUri());
        }