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);
            }
        }
Exemplo n.º 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());
        }
Exemplo n.º 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));
            }
        }
Exemplo n.º 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"));
        }
Exemplo n.º 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"));
        }
Exemplo n.º 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());
        }