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());
        }
Example #2
0
        public void clone_for_topic()
        {
            var uri = new TransportUri(
                "rabbitmq",
                "conn1",
                true,
                "queue1",
                "*",
                "subscription1",
                "routingKey1");

            var clone = uri.CloneForTopic("topic1");

            clone.Protocol.ShouldBe(uri.Protocol);
            clone.ConnectionName.ShouldBe(uri.ConnectionName);
            clone.Durable.ShouldBe(uri.Durable);
            clone.QueueName.ShouldBe(uri.QueueName);
            clone.SubscriptionName.ShouldBe(uri.SubscriptionName);
            clone.RoutingKey.ShouldBe(uri.RoutingKey);

            clone.TopicName.ShouldBe("topic1");
        }