Exemple #1
0
        public Task <ISendTransport> CreateSendTransport(IClientContextSupervisor clientContextSupervisor, Uri address)
        {
            LogContext.SetCurrentIfNull(_hostConfiguration.LogContext);

            var endpointAddress = new AmazonSqsEndpointAddress(_hostConfiguration.HostAddress, address);

            TransportLogMessages.CreateSendTransport(endpointAddress);

            if (endpointAddress.Type == AmazonSqsEndpointAddress.AddressType.Queue)
            {
                var settings = _topologyConfiguration.Send.GetSendSettings(endpointAddress);

                IPipe <ClientContext> configureTopology = new ConfigureTopologyFilter <EntitySettings>(settings, settings.GetBrokerTopology()).ToPipe();

                return(CreateTransport(clientContextSupervisor, configureTopology, settings.EntityName, x => new QueueSendTransport(x)));
            }
            else
            {
                var settings = new TopicPublishSettings(endpointAddress);

                var builder     = new PublishEndpointBrokerTopologyBuilder();
                var topicHandle = builder.CreateTopic(settings.EntityName, settings.Durable, settings.AutoDelete, settings.TopicAttributes, settings
                                                      .TopicSubscriptionAttributes, settings.Tags);

                builder.Topic ??= topicHandle;

                IPipe <ClientContext> configureTopology = new ConfigureTopologyFilter <EntitySettings>(settings, builder.BuildBrokerTopology()).ToPipe();

                return(CreateTransport(clientContextSupervisor, configureTopology, settings.EntityName, x => new TopicSendTransport(x)));
            }
        }
        public void Setup()
        {
            _nameFormatter       = new ServiceBusMessageNameFormatter();
            _entityNameFormatter = new MessageNameFormatterEntityNameFormatter(_nameFormatter);
            _publishTopology     = new ServiceBusPublishTopology(AzureBusFactory.MessageTopology);

            _builder = new PublishEndpointBrokerTopologyBuilder(_publishTopology);
        }
        public BrokerTopology GetBrokerTopology()
        {
            var builder = new PublishEndpointBrokerTopologyBuilder();

            builder.CreateQueue(EntityName, Durable, AutoDelete, null, null, QueueTags);

            return(builder.BuildBrokerTopology());
        }
        public BrokerTopology GetBrokerTopology()
        {
            var builder = new PublishEndpointBrokerTopologyBuilder();

            builder.Topic = builder.CreateTopic(EntityName, Durable, AutoDelete);

            return(builder.BuildBrokerTopology());
        }
        public BrokerTopology GetBrokerTopology()
        {
            var builder = new PublishEndpointBrokerTopologyBuilder();

            builder.Topic = builder.CreateTopic(_description);

            return(builder.BuildBrokerTopology());
        }
        public BrokerTopology GetBrokerTopology()
        {
            var builder = new PublishEndpointBrokerTopologyBuilder(_publishTopology.BrokerTopologyOptions);

            Apply(builder);

            return(builder.BuildBrokerTopology());
        }
        public BrokerTopology GetBrokerTopology()
        {
            var builder = new PublishEndpointBrokerTopologyBuilder();

            builder.CreateQueue(EntityName, Durable, AutoDelete, QueueAttributes, QueueSubscriptionAttributes, QueueTags);

            return(builder.BuildBrokerTopology());
        }
Exemple #8
0
        public void Setup()
        {
            _nameFormatter       = new RabbitMqMessageNameFormatter();
            _entityNameFormatter = new MessageNameFormatterEntityNameFormatter(_nameFormatter);
            _publishTopology     = new RabbitMqPublishTopology(RabbitMqBusFactory.MessageTopology);

            _builder = new PublishEndpointBrokerTopologyBuilder(PublishBrokerTopologyOptions.MaintainHierarchy);
        }
Exemple #9
0
        public SendSettings GetSendSettings()
        {
            var description = GetTopicDescription();

            var builder = new PublishEndpointBrokerTopologyBuilder(_publishTopology);

            Apply(builder);

            return(new TopicSendSettings(description, builder.BuildBrokerTopology()));
        }
Exemple #10
0
        public BrokerTopology GetBrokerTopology()
        {
            var builder = new PublishEndpointBrokerTopologyBuilder();

            builder.Exchange = builder.ExchangeDeclare(ExchangeName, ExchangeType, Durable, AutoDelete, ExchangeArguments);

            var queue = builder.QueueDeclare(QueueName, Durable, AutoDelete, false, QueueArguments);

            builder.QueueBind(builder.Exchange, queue, RoutingKey, BindingArguments);

            return(builder.BuildBrokerTopology());
        }
Exemple #11
0
        public BrokerTopology GetBrokerTopology()
        {
            var builder = new PublishEndpointBrokerTopologyBuilder();

            builder.Topic = builder.CreateTopic(EntityName, Durable, AutoDelete);

            if (_bindToQueue)
            {
                var queue = builder.CreateQueue(_queueName, Durable, AutoDelete);

                builder.CreateTopicSubscription(builder.Topic, queue);
            }

            return(builder.BuildBrokerTopology());
        }
        Task <ISendTransport> ISendTransportProvider.GetSendTransport(Uri address)
        {
            var endpointAddress = new AmazonSqsEndpointAddress(_hostConfiguration.HostAddress, address);

            LogContext.SetCurrentIfNull(_hostConfiguration.LogContext);

            TransportLogMessages.CreateSendTransport(endpointAddress);

            if (endpointAddress.Type == AmazonSqsEndpointAddress.AddressType.Queue)
            {
                var settings = _topologyConfiguration.Send.GetSendSettings(endpointAddress);

                var clientContextSupervisor = new ClientContextSupervisor(this);

                IPipe <ClientContext> configureTopologyPipe = new ConfigureTopologyFilter <SendSettings>(settings, settings.GetBrokerTopology()).ToPipe();

                var transportContext = new SendTransportContext(clientContextSupervisor, configureTopologyPipe, settings.EntityName,
                                                                _hostConfiguration.SendLogContext, _hostConfiguration.Settings.AllowTransportHeader);

                var transport = new QueueSendTransport(transportContext);
                Add(transport);

                return(Task.FromResult <ISendTransport>(transport));
            }
            else
            {
                var settings = new TopicPublishSettings(endpointAddress);

                var clientContextSupervisor = new ClientContextSupervisor(this);

                var builder     = new PublishEndpointBrokerTopologyBuilder();
                var topicHandle = builder.CreateTopic(settings.EntityName, settings.Durable, settings.AutoDelete, settings.TopicAttributes, settings
                                                      .TopicSubscriptionAttributes, settings.Tags);

                builder.Topic ??= topicHandle;

                IPipe <ClientContext> configureTopologyPipe = new ConfigureTopologyFilter <PublishSettings>(settings, builder.BuildBrokerTopology()).ToPipe();

                var transportContext = new SendTransportContext(clientContextSupervisor, configureTopologyPipe, settings.EntityName,
                                                                _hostConfiguration.SendLogContext, _hostConfiguration.Settings.AllowTransportHeader);

                var transport = new TopicSendTransport(transportContext);
                Add(transport);

                return(Task.FromResult <ISendTransport>(transport));
            }
        }
        public SendSettings GetSendSettings(ServiceBusEndpointAddress address)
        {
            if (address.Type == ServiceBusEndpointAddress.AddressType.Queue)
            {
                var queueDescription = GetQueueDescription(address);

                return(new QueueSendSettings(queueDescription));
            }

            var topicDescription = GetTopicDescription(address);

            var builder = new PublishEndpointBrokerTopologyBuilder();

            builder.Topic = builder.CreateTopic(topicDescription);

            return(new TopicSendSettings(topicDescription, builder.BuildBrokerTopology()));
        }
        public Task <ISendTransport> CreateSendTransport(AmazonSqsEndpointAddress address)
        {
            TransportLogMessages.CreateSendTransport(address);

            if (address.Type == AmazonSqsEndpointAddress.AddressType.Queue)
            {
                var settings = _hostTopology.SendTopology.GetSendSettings(address);

                var clientContextSupervisor = new AmazonSqsClientContextSupervisor(ConnectionContextSupervisor);

                var configureTopologyPipe = new ConfigureTopologyFilter <SendSettings>(settings, settings.GetBrokerTopology()).ToPipe();

                var transportContext = new HostSqsSendTransportContext(clientContextSupervisor, configureTopologyPipe, settings.EntityName, SendLogContext,
                                                                       _hostConfiguration.Settings.AllowTransportHeader);

                var transport = new QueueSendTransport(transportContext);
                Add(transport);

                return(Task.FromResult <ISendTransport>(transport));
            }
            else
            {
                var settings = new TopicPublishSettings(address);

                var clientContextSupervisor = new AmazonSqsClientContextSupervisor(ConnectionContextSupervisor);

                var builder     = new PublishEndpointBrokerTopologyBuilder();
                var topicHandle = builder.CreateTopic(settings.EntityName, settings.Durable, settings.AutoDelete, settings.TopicAttributes, settings
                                                      .TopicSubscriptionAttributes, settings.Tags);

                builder.Topic ??= topicHandle;

                var configureTopologyPipe = new ConfigureTopologyFilter <PublishSettings>(settings, builder.BuildBrokerTopology()).ToPipe();

                var transportContext = new HostSqsSendTransportContext(clientContextSupervisor, configureTopologyPipe, settings.EntityName, SendLogContext,
                                                                       _hostConfiguration.Settings.AllowTransportHeader);

                var transport = new TopicSendTransport(transportContext);
                Add(transport);

                return(Task.FromResult <ISendTransport>(transport));
            }
        }
        public BrokerTopology GetBrokerTopology()
        {
            var builder = new PublishEndpointBrokerTopologyBuilder();

            builder.Exchange = builder.ExchangeDeclare(ExchangeName, ExchangeType, Durable, AutoDelete, ExchangeArguments);

            foreach (var specification in _exchangeBindings)
            {
                specification.Apply(builder);
            }

            if (_bindToQueue)
            {
                var queue = builder.QueueDeclare(_queueName ?? ExchangeName, Durable, AutoDelete, false, QueueArguments);

                builder.QueueBind(builder.Exchange, queue, "", new Dictionary <string, object>());
            }

            return(builder.BuildBrokerTopology());
        }
        public BrokerTopology GetBrokerTopology(Uri address)
        {
            var settings = GetSendSettings(address);

            var builder = new PublishEndpointBrokerTopologyBuilder();

            builder.Exchange = builder.ExchangeDeclare(settings.ExchangeName, settings.ExchangeType, settings.Durable, settings.AutoDelete,
                                                       settings.ExchangeArguments);

            if (settings.BindToQueue)
            {
                var queue = builder.QueueDeclare(settings.QueueName, settings.Durable, settings.AutoDelete, false, settings.QueueArguments);
                builder.QueueBind(builder.Exchange, queue, "", new Dictionary <string, object>());
            }

            foreach (var specification in settings.PublishTopologySpecifications)
            {
                specification.Apply(builder);
            }

            return(builder.BuildTopologyLayout());
        }
        Task <CachedSendEndpoint <TypeKey> > CreateSendEndpoint <T>(TypeKey typeKey, IRabbitMqMessagePublishTopology <T> publishTopology)
            where T : class
        {
            var sendSettings = publishTopology.GetSendSettings();

            var builder = new PublishEndpointBrokerTopologyBuilder(_host.Topology.PublishTopology.BrokerTopologyOptions);

            publishTopology.Apply(builder);

            var topology = builder.BuildTopologyLayout();

            var modelCache = new RabbitMqModelCache(_host);

            var sendTransport = new RabbitMqSendTransport(modelCache, new ConfigureTopologyFilter <SendSettings>(sendSettings, topology),
                                                          sendSettings.ExchangeName);

            sendTransport.ConnectSendObserver(_sendObservable);

            var sendEndpoint = new SendEndpoint(sendTransport, _serializer, typeKey.Address, _sourceAddress, SendPipe.Empty);

            return(Task.FromResult(new CachedSendEndpoint <TypeKey>(typeKey, sendEndpoint)));
        }