Пример #1
0
        private void Store(string uniqueMessageId, FailedMessage.ProcessingAttempt processingAttempt, List <FailedMessage.FailureGroup> groups)
        {
            var documentId = FailedMessage.MakeDocumentId(uniqueMessageId);

            store.DatabaseCommands.Patch(documentId,
                                         new[]
            {
                new PatchRequest
                {
                    Name  = nameof(FailedMessage.Status),
                    Type  = PatchCommandType.Set,
                    Value = (int)FailedMessageStatus.Unresolved
                },
                new PatchRequest
                {
                    Name  = nameof(FailedMessage.ProcessingAttempts),
                    Type  = PatchCommandType.Add,
                    Value = RavenJToken.FromObject(processingAttempt, Serializer)     // Need to specify serializer here because otherwise the $type for EndpointDetails is missing and this causes EventDispatcher to blow up!
                },
                new PatchRequest
                {
                    Name  = nameof(FailedMessage.FailureGroups),
                    Type  = PatchCommandType.Set,
                    Value = RavenJToken.FromObject(groups)
                }
            },
                                         new[]
            {
                new PatchRequest
                {
                    Name  = nameof(FailedMessage.UniqueMessageId),
                    Type  = PatchCommandType.Set,
                    Value = uniqueMessageId
                },
                new PatchRequest
                {
                    Name  = nameof(FailedMessage.Status),
                    Type  = PatchCommandType.Set,
                    Value = (int)FailedMessageStatus.Unresolved
                },
                new PatchRequest
                {
                    Name  = nameof(FailedMessage.ProcessingAttempts),
                    Type  = PatchCommandType.Add,
                    Value = RavenJToken.FromObject(processingAttempt, Serializer)     // Need to specify serilaizer here because otherwise the $type for EndpointDetails is missing and this causes EventDispatcher to blow up!
                },
                new PatchRequest
                {
                    Name  = nameof(FailedMessage.FailureGroups),
                    Type  = PatchCommandType.Set,
                    Value = RavenJToken.FromObject(groups)
                }
            }, JObjectMetadata
                                         );
        }
            public ProcessingAttemptInfo(PreSplitScenario scenario, string failedQ, bool isRetry)
            {
                FailedQ = failedQ;
                Attempt = new FailedMessage.ProcessingAttempt
                {
                    MessageId      = scenario.MessageId,
                    AttemptedAt    = DateTime.UtcNow.AddDays(-1),
                    ReplyToAddress = scenario.ReplyToAddress,
                    FailureDetails = new FailureDetails
                    {
                        AddressOfFailingEndpoint = failedQ,
                        Exception = new ExceptionDetails
                        {
                            ExceptionType = "SomeExceptionType",
                            Message       = "An Exception Message",
                            Source        = "TestScenario"
                        }
                    },
                    Headers = new Dictionary <string, string>
                    {
                        { FaultsHeaderKeys.FailedQ, failedQ },
                        { Headers.MessageId, scenario.MessageId },
                        { Headers.ReplyToAddress, scenario.ReplyToAddress }
                    },
                    MessageMetadata = new Dictionary <string, object>
                    {
                        { "MessageType", MessageType }
                    }
                };
                ExpectedUniqueMessageId = Attempt.Headers.UniqueId();

                if (isRetry)
                {
                    Attempt.Headers.Add(V4RetryUniqueMessageIdHeader, scenario.UniqueMessageId);
                }
            }
Пример #3
0
        public List <FailedMessage.FailureGroup> GetGroups(string messageType, FailureDetails failureDetails, FailedMessage.ProcessingAttempt processingAttempt)
        {
            var groups = new List <FailedMessage.FailureGroup>();

            foreach (var enricher in failedEnrichers)
            {
                groups.AddRange(enricher.Enrich(messageType, failureDetails, processingAttempt));
            }
            return(groups);
        }