예제 #1
0
        Task MessageRedeliveryContext.ScheduleRedelivery(TimeSpan delay, Action <ConsumeContext, SendContext> callback = null)
        {
            Action <ConsumeContext, SendContext> combinedCallback = UpdateDeliveryContext + callback;

            return(_scheduler.ScheduleSend(_context.ReceiveContext.InputAddress, delay, _context.Message,
                                           _context.CreateCopyContextPipe(combinedCallback)));
        }
        async Task MessageRedeliveryContext.ScheduleRedelivery(TimeSpan delay)
        {
            var receiveSettings = _context.ReceiveContext.GetPayload <ReceiveSettings>();

            var delayExchangeAddress = GetDelayExchangeAddress(receiveSettings);

            ISendEndpoint delayEndpoint = await _context.GetSendEndpoint(delayExchangeAddress).ConfigureAwait(false);

            await delayEndpoint.Send(_context.Message, _context.CreateCopyContextPipe((x, y) => UpdateDeliveryContext(x, y, delay))).ConfigureAwait(false);
        }
예제 #3
0
            public Task Consume(ConsumeContext <A> context)
            {
                if (GetVirtualHost(context.SourceAddress) != GetVirtualHost(context.ReceiveContext.InputAddress))
                {
                    return(TaskUtil.Completed);
                }

                LogContext.Info?.Log("Forwarding message: {MessageId} from {SourceAddress}", context.MessageId, context.SourceAddress);

                IPipe <SendContext> contextPipe = context.CreateCopyContextPipe();

                return(_otherHost.Publish(context.Message, contextPipe));
            }
예제 #4
0
            public Task Consume(ConsumeContext <A> context)
            {
                if (GetVirtualHost(context.SourceAddress) != GetVirtualHost(context.ReceiveContext.InputAddress))
                {
                    return(TaskUtil.Completed);
                }

                if (_log.IsInfoEnabled)
                {
                    _log.Info($"Forwarding message: {context.MessageId} from {context.SourceAddress}");
                }

                IPipe <SendContext> contextPipe = context.CreateCopyContextPipe();

                return(_otherHost.Publish(context.Message, contextPipe));
            }
        async Task MessageRedeliveryContext.ScheduleRedelivery(TimeSpan delay)
        {
            var receiveSettings = _context.ReceiveContext.GetPayload <ReceiveSettings>();

            string delayExchangeName = receiveSettings.QueueName + "_delay";
            var    sendSettings      = new RabbitMqSendSettings(delayExchangeName, "x-delayed-message", receiveSettings.Durable, receiveSettings.AutoDelete);

            sendSettings.SetExchangeArgument("x-delayed-type", receiveSettings.ExchangeType);

            sendSettings.BindToQueue(receiveSettings.QueueName);

            var modelContext = _context.ReceiveContext.GetPayload <ModelContext>();

            Uri delayExchangeAddress = modelContext.ConnectionContext.HostSettings.GetSendAddress(sendSettings);

            ISendEndpoint delayEndpoint = await _context.GetSendEndpoint(delayExchangeAddress);

            await delayEndpoint.Send(_context.Message, _context.CreateCopyContextPipe((x, y) => UpdateDeliveryContext(x, y, delay)));
        }
예제 #6
0
 Task MessageRedeliveryContext.ScheduleRedelivery(TimeSpan delay)
 {
     return(_scheduler.ScheduleSend(_context.ReceiveContext.InputAddress, delay, _context.Message,
                                    _context.CreateCopyContextPipe(UpdateDeliveryContext)));
 }