ISendTransport CreateSendTransport(IModelContextSupervisor modelContextSupervisor, IPipe <ModelContext> pipe, string exchangeName)
        {
            var sendTransportContext = new SendTransportContext(modelContextSupervisor, pipe, exchangeName, _hostConfiguration.SendLogContext);

            var transport = new RabbitMqSendTransport(sendTransportContext);

            Add(transport);

            return(transport);
        }
Пример #2
0
        ISendTransport CreateSendTransport(Uri address, SendSettings settings)
        {
            TransportLogMessages.CreateSendTransport(address);

            var endpointContextSupervisor = CreateSendEndpointContextSupervisor(settings);

            var transportContext = new SendTransportContext(_hostConfiguration, address, endpointContextSupervisor);

            return(new ServiceBusSendTransport(transportContext));
        }
        Task <ISendTransport> CreateSendTransport(IModelContextSupervisor modelContextSupervisor, IPipe <ModelContext> pipe, string exchangeName)
        {
            var sendTransportContext = new SendTransportContext(_hostConfiguration, modelContextSupervisor, pipe, exchangeName);

            var transport = new RabbitMqSendTransport(sendTransportContext);

            AddSendAgent(transport);

            return(Task.FromResult <ISendTransport>(transport));
        }
        Task <ISendTransport> CreateSendTransport(ISessionContextSupervisor supervisor, IPipe <SessionContext> pipe, string entityName,
                                                  DestinationType destinationType)
        {
            var sendTransportContext = new SendTransportContext(supervisor, pipe, entityName, destinationType,
                                                                _hostConfiguration.SendLogContext);

            var transport = new ActiveMqSendTransport(sendTransportContext);

            Add(transport);

            return(Task.FromResult <ISendTransport>(transport));
        }
        ISendTransport CreateSendTransport(Uri address, SendSettings settings)
        {
            LogContext.SetCurrentIfNull(_hostConfiguration.LogContext);

            TransportLogMessages.CreateSendTransport(address);

            var endpointContextSupervisor = CreateSendEndpointContextSupervisor(settings);

            var transportContext = new SendTransportContext(address, endpointContextSupervisor, _hostConfiguration.SendLogContext);

            return(new ServiceBusSendTransport(transportContext));
        }
Пример #6
0
        Task <ISendTransport> CreateTransport <T>(IClientContextSupervisor clientContextSupervisor, IPipe <ClientContext> configureTopology, string entityName,
                                                  Func <SqsSendTransportContext, T> factory)
            where T : Supervisor, ISendTransport
        {
            var supervisor = new ClientContextSupervisor(clientContextSupervisor);

            var transportContext = new SendTransportContext(_hostConfiguration, supervisor, configureTopology, entityName);

            var transport = factory(transportContext);

            clientContextSupervisor.AddSendAgent(transport);

            return(Task.FromResult <ISendTransport>(transport));
        }
        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));
            }
        }
Пример #8
0
        public Task <ISendTransport> CreatePublishTransport <T>(IClientContextSupervisor supervisor)
            where T : class
        {
            LogContext.SetCurrentIfNull(_hostConfiguration.LogContext);

            IAmazonSqsMessagePublishTopology <T> publishTopology = _topologyConfiguration.Publish.GetMessageTopology <T>();

            var settings = publishTopology.GetPublishSettings(_hostConfiguration.HostAddress);

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

            var transportContext = new SendTransportContext(_hostConfiguration, supervisor, configureTopology, settings.EntityName);

            var transport = new TopicSendTransport(transportContext);

            supervisor.AddSendAgent(transport);

            return(Task.FromResult <ISendTransport>(transport));
        }
Пример #9
0
        Task <ISendTransport> CreateSendTransport(IModelContextSupervisor modelContextSupervisor, IPipe <ModelContext> pipe, string exchangeName,
                                                  RabbitMqEndpointAddress endpointAddress)
        {
            var supervisor = new ModelContextSupervisor(modelContextSupervisor);

            var delayedExchangeAddress = endpointAddress.GetDelayAddress();

            var delaySettings = new RabbitMqDelaySettings(delayedExchangeAddress);

            delaySettings.BindToExchange(exchangeName);

            IPipe <ModelContext> delayPipe = new ConfigureTopologyFilter <DelaySettings>(delaySettings, delaySettings.GetBrokerTopology()).ToPipe();

            var sendTransportContext = new SendTransportContext(_hostConfiguration, supervisor, pipe, exchangeName, delayPipe, delaySettings.ExchangeName);

            var transport = new RabbitMqSendTransport(sendTransportContext);

            modelContextSupervisor.AddSendAgent(transport);

            return(Task.FromResult <ISendTransport>(transport));
        }
        public Task <ISendTransport> GetPublishTransport <T>(Uri publishAddress)
            where T : class
        {
            LogContext.SetCurrentIfNull(_hostConfiguration.LogContext);

            IAmazonSqsMessagePublishTopology <T> publishTopology = _topologyConfiguration.Publish.GetMessageTopology <T>();

            var settings = publishTopology.GetPublishSettings(_hostConfiguration.HostAddress);

            var clientContextSupervisor = new ClientContextSupervisor(this);

            IPipe <ClientContext> configureTopologyPipe = new ConfigureTopologyFilter <PublishSettings>(settings, publishTopology.GetBrokerTopology()).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));
        }