public Uri GetDelayedExchangeDestinationAddress(Uri address) { var endpointAddress = new RabbitMqEndpointAddress(_hostAddress, address); var delayedExchangeAddress = endpointAddress.GetDelayAddress(); var settings = new RabbitMqSendSettings(delayedExchangeAddress); settings.BindToExchange(endpointAddress.Name); return(settings.GetSendAddress(_hostAddress)); }
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)); }