コード例 #1
0
        ISendTransport CreateSendTransport(Uri address, SendSettings settings)
        {
            var endpointContextSupervisor = CreateSendEndpointContextSupervisor(settings);

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

            var transport = new ServiceBusSendTransport(transportContext);

            Add(transport);

            return(transport);
        }
コード例 #2
0
        ISendTransport GetSendTransport(Uri address)
        {
            var host = _busConfiguration.GetHost(address);

            var settings = host.Topology.SendTopology.GetSendSettings(address);

            IAgent <SendEndpointContext> source = GetSendEndpointContextSource(host, settings, settings.GetBrokerTopology());

            var transport = new ServiceBusSendTransport(source, address);

            host.Add(transport);

            return(transport);
        }
コード例 #3
0
        ISendTransport GetSendTransport <T>(Uri address)
            where T : class
        {
            var host = _busConfiguration.GetHost(address);

            var settings = _publishTopology.GetMessageTopology <T>().GetSendSettings();

            IAgent <SendEndpointContext> source = GetSendEndpointContextSource(host, settings, settings.GetBrokerTopology());

            var transport = new ServiceBusSendTransport(source, address);

            host.Add(transport);

            return(transport);
        }
コード例 #4
0
        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));
        }
コード例 #5
0
        public Task <ISendTransport> CreatePublishTransport <T>()
            where T : class
        {
            var publishTopology = _hostTopology.Publish <T>();

            if (!publishTopology.TryGetPublishAddress(_hostConfiguration.HostAddress, out Uri publishAddress))
            {
                throw new ArgumentException($"The type did not return a valid publish address: {TypeMetadataCache<T>.ShortName}");
            }

            var settings = publishTopology.GetSendSettings();

            var endpointContextSupervisor = CreateTopicSendEndpointContextSupervisor(settings);

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

            var transport = new ServiceBusSendTransport(transportContext);

            Add(transport);

            return(Task.FromResult <ISendTransport>(transport));
        }