Exemple #1
0
        Task <ISendTransport> IServiceBusHostControl.CreateSendTransport(ServiceBusEndpointAddress address)
        {
            if (_host == null)
            {
                throw new InvalidOperationException("The host is not ready.");
            }

            return(_host.CreateSendTransport(address));
        }
        public Task <ISendTransport> GetSendTransport(Uri address)
        {
            var endpointAddress = new ServiceBusEndpointAddress(_hostConfiguration.HostAddress, address);

            var settings = _topologyConfiguration.Send.GetSendSettings(endpointAddress);

            var transport = CreateSendTransport(endpointAddress, settings);

            return(Task.FromResult(transport));
        }
        public void Should_have_the_full_path()
        {
            var address = new ServiceBusEndpointAddress(HostAddress, "input_queue");

            Assert.That((Uri)address, Is.EqualTo(InputQueueAddress));

            Assert.That(address.Name, Is.EqualTo("input_queue"));
            Assert.That(address.Scope, Is.EqualTo(typeof(An_address).Namespace));

            Assert.That(address.Path, Is.EqualTo(InputQueueAddress.AbsolutePath.Substring(1)));
        }
        static TopicDescription GetTopicDescription(ServiceBusEndpointAddress address)
        {
            var topicDescription = Defaults.CreateTopicDescription(address.Path);

            if (address.AutoDelete.HasValue)
            {
                topicDescription.AutoDeleteOnIdle = address.AutoDelete.Value;
            }

            return(topicDescription);
        }
        static QueueDescription GetQueueDescription(ServiceBusEndpointAddress address)
        {
            var queueDescription = Defaults.CreateQueueDescription(address.Path);

            if (address.AutoDelete.HasValue)
            {
                queueDescription.AutoDeleteOnIdle = address.AutoDelete.Value;
            }

            return(queueDescription);
        }
        public override bool TryGetPublishAddress(Type messageType, out Uri publishAddress)
        {
            if (base.TryGetPublishAddress(messageType, out publishAddress))
            {
                publishAddress = new ServiceBusEndpointAddress(_hostConfiguration.HostAddress, publishAddress,
                                                               ServiceBusEndpointAddress.AddressType.Topic).TopicAddress;
                return(true);
            }

            return(false);
        }
        public SendSettings GetDeadLetterSettings(ISubscriptionConfigurator configurator, Uri hostAddress)
        {
            var description = configurator.GetSubscriptionDescription();

            var deadLetterEndpointAddress = new ServiceBusEndpointAddress(hostAddress, description.SubscriptionName + DeadLetterQueueSuffix);

            var queueDescription = Defaults.CreateQueueDescription(deadLetterEndpointAddress.Path);

            queueDescription.DefaultMessageTimeToLive = description.DefaultMessageTimeToLive;
            queueDescription.AutoDeleteOnIdle         = description.AutoDeleteOnIdle;

            return(new QueueSendSettings(queueDescription));
        }
        public async Task <ISendTransport> CreateSendTransport(ServiceBusEndpointAddress address)
        {
            Task <CachedSendTransport> Create(Uri transportAddress)
            {
                TransportLogMessages.CreateSendTransport(address);

                var settings = _hostTopology.SendTopology.GetSendSettings(address);

                var transport = CreateSendTransport(address, settings);

                return(Task.FromResult(new CachedSendTransport(transportAddress, transport)));
            }

            return(await _index.Get(address, Create).ConfigureAwait(false));
        }
        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()));
        }
Exemple #10
0
        public SendSettings GetErrorSettings(ISubscriptionConfigurator configurator, Uri hostAddress)
        {
            var description = configurator.GetSubscriptionDescription();

            var errorEndpointAddress = new ServiceBusEndpointAddress(hostAddress, description.SubscriptionName + ErrorQueueSuffix);

            var queueDescription = Defaults.CreateQueueDescription(errorEndpointAddress.Path);

            queueDescription.DefaultMessageTimeToLive = description.DefaultMessageTimeToLive;
            queueDescription.AutoDeleteOnIdle         = description.AutoDeleteOnIdle;

            var errorSettings = new QueueSendSettings(queueDescription);

            ConfigureErrorSettings?.Invoke(errorSettings);

            return(errorSettings);
        }
        public async Task <ISendTransport> CreateSendTransport(ServiceBusEndpointAddress address)
        {
            Task <CachedSendTransport> Create(Uri transportAddress)
            {
                var settings = _hostTopology.SendTopology.GetSendSettings(address);

                var endpointContextSupervisor = CreateQueueSendEndpointContextSupervisor(settings);

                var transportContext = new HostServiceBusSendTransportContext(address, endpointContextSupervisor, SendLogContext);

                var transport = new ServiceBusSendTransport(transportContext);

                Add(transport);

                return(Task.FromResult(new CachedSendTransport(transportAddress, transport)));
            }

            return(await _index.Get(address, Create).ConfigureAwait(false));
        }
Exemple #12
0
 public override bool TryGetPublishAddress(Uri baseAddress, out Uri publishAddress)
 {
     publishAddress = new ServiceBusEndpointAddress(new Uri(baseAddress.GetLeftPart(UriPartial.Authority)), _topicConfigurator.FullPath);
     return(true);
 }
Exemple #13
0
        Task <ISendTransport> ISendTransportProvider.GetSendTransport(Uri address)
        {
            var endpointAddress = new ServiceBusEndpointAddress(_host.Address, address);

            return(_host.CreateSendTransport(endpointAddress));
        }
Exemple #14
0
        public SendSettings GetSendSettings(ServiceBusEndpointAddress address)
        {
            var queueDescription = GetQueueDescription(address);

            return(new QueueSendSettings(queueDescription));
        }
 public override bool TryGetPublishAddress(Uri baseAddress, out Uri publishAddress)
 {
     publishAddress = new ServiceBusEndpointAddress(baseAddress, _messageTopology.EntityName);
     return(true);
 }