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); } }
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()); }
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)); } }
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")); }
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")); }
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()); }