Esempio n. 1
0
        public virtual async Task <Message> OnSendingAsync(Message envelope, CancellationToken cancellationToken)
        {
            if (string.IsNullOrWhiteSpace(envelope.Id))
            {
                return(envelope);
            }
            var messageKey = _keyProvider.GetMessageKey(envelope, _channel);

            var resendCount = GetMessageResendCount(envelope);

            await _messageStorage.AddAsync(
                _channelKey,
                messageKey,
                envelope,
                DateTimeOffset.UtcNow.AddTicks(_resendWindow.Ticks * (resendCount + 1)),
                cancellationToken);

            return(envelope);
        }