示例#1
0
        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));
        }
示例#2
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));
        }