Alexandria.Client.Infrastructure.CachingMessageModule.TransportOnMessageSent C# (CSharp) Méthode

TransportOnMessageSent() private méthode

private TransportOnMessageSent ( Rhino.ServiceBus.Impl.CurrentMessageInformation currentMessageInformation ) : void
currentMessageInformation Rhino.ServiceBus.Impl.CurrentMessageInformation
Résultat void
        private void TransportOnMessageSent(CurrentMessageInformation currentMessageInformation)
        {
            var containsNonCachableMessages = currentMessageInformation.AllMessages.Any(x=>x is ICacheableRequest == false);

            var cacheableRequests = currentMessageInformation.AllMessages.OfType<ICacheableRequest>();
            if(containsNonCachableMessages)
            {
                // since we are making a non cachable request, the
                // _cachable_ requests part of this batch are likely to be
                // affected by this message, so we go ahead and expire them
                // to avoid showing incorrect data
                foreach (var cachableRequestToExpire in cacheableRequests)
                {
                    cache.Remove(cachableRequestToExpire.Key);
                }
                return;
            }

            var responses =
                from msg in cacheableRequests
                let response = cache.Get(msg.Key)
                where response != null
                select response.Value;

            var array = responses.ToArray();
            if (array.Length == 0)
                return;
            bus.ConsumeMessages(array);
        }