public Task <ISendTransport> CreateSendTransport(IClientContextSupervisor supervisor, 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 <SendSettings>(settings, settings.GetBrokerTopology()).ToPipe(); var transportContext = new SendTransportContext(_hostConfiguration, supervisor, configureTopology, settings.EntityName); var transport = new QueueSendTransport(transportContext); supervisor.AddSendAgent(transport); return(Task.FromResult <ISendTransport>(transport)); } 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 <PublishSettings>(settings, builder.BuildBrokerTopology()).ToPipe(); var transportContext = new SendTransportContext(_hostConfiguration, supervisor, configureTopology, settings.EntityName); var transport = new TopicSendTransport(transportContext); supervisor.AddSendAgent(transport); return(Task.FromResult <ISendTransport>(transport)); } }
public ProducerContextSupervisor(string topicName, ISendPipe sendPipe, SendObservable sendObservers, IClientContextSupervisor clientContextSupervisor, IHostConfiguration hostConfiguration, IHeadersSerializer headersSerializer, Func <ProducerBuilder <TKey, TValue> > producerBuilderFactory) : base(new ProducerContextFactory <TKey, TValue>(clientContextSupervisor, headersSerializer, producerBuilderFactory)) { _sendObservers = sendObservers; _hostConfiguration = hostConfiguration; _topicAddress = new KafkaTopicAddress(hostConfiguration.HostAddress, topicName); _sendPipe = sendPipe; clientContextSupervisor.AddSendAgent(this); }
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)); }
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)); }
public ClientContextSupervisor(IClientContextSupervisor clientContextSupervisor) : base(new ScopeClientContextFactory(clientContextSupervisor)) { clientContextSupervisor.AddSendAgent(this); }