public Task <ISendTransport> CreateSendTransport(AmazonSqsEndpointAddress address)
        {
            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));
        }
        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));
            }
        }
Exemple #3
0
        public Task <ISendTransport> CreatePublishTransport <T>()
            where T : class
        {
            IAmazonSqsMessagePublishTopology <T> publishTopology = _hostTopology.Publish <T>();

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

            var clientContextSupervisor = new AmazonSqsClientContextSupervisor(ConnectionContextSupervisor);

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