Пример #1
0
        private void InnerHandle(TransportMessage message)
        {
            var entity = auditImporter.ConvertToSaveMessage(message);

            using (var session = store.OpenSession())
            {
                session.Store(entity);
                session.SaveChanges();
            }

            if (settings.ForwardAuditMessages)
            {
                TransportMessageCleaner.CleanForForwarding(message);
                forwarder.Send(message, new SendOptions(settings.AuditLogQueue));
            }
        }
Пример #2
0
        private void InnerHandle(TransportMessage message)
        {
            var metadata = new Dictionary <string, object>
            {
                ["MessageId"]           = message.Id,
                ["MessageIntent"]       = message.MessageIntent,
                ["HeadersForSearching"] = string.Join(" ", message.Headers.Values)
            };

            foreach (var enricher in enrichers)
            {
                enricher.Enrich(message.Headers, metadata);
            }

            bodyStorageEnricher.StoreErrorMessageBody(
                message.Body,
                message.Headers,
                metadata);

            var failureDetails = failedMessageFactory.ParseFailureDetails(message.Headers);

            var replyToAddress = message.ReplyToAddress == null ? null : message.ReplyToAddress.ToString();

            var processingAttempt = failedMessageFactory.CreateProcessingAttempt(
                message.Headers,
                metadata,
                failureDetails,
                message.MessageIntent,
                message.Recoverable,
                message.CorrelationId,
                replyToAddress);

            var groups = failedMessageFactory.GetGroups((string)metadata["MessageType"], failureDetails, processingAttempt);

            Store(message.Headers.UniqueId(), processingAttempt, groups);

            AnnounceFailedMessage(message.Headers, failureDetails);

            if (settings.ForwardErrorMessages)
            {
                TransportMessageCleaner.CleanForForwarding(message);
                forwarder.Send(message, new SendOptions(settings.ErrorLogQueue));
            }
        }