/
MessageFailed.cs
167 lines (141 loc) · 4.7 KB
/
MessageFailed.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
namespace ServiceControl.Contracts
{
using System;
using System.Collections.Generic;
/// <summary>
/// Event emitted for each message that ServiceControl detects as failed
/// </summary>
public class MessageFailed
{
/// <summary>
/// The unique identifier for this failure generated by the ServiceControl
/// </summary>
public string FailedMessageId { get; set; }
/// <summary>
/// The message type of the message
/// </summary>
public string MessageType { get; set; }
/// <summary>
/// The number of times this message was attempted to be processed
/// </summary>
public int NumberOfProcessingAttempts { get; set; }
/// <summary>
/// Status of the failed message
/// </summary>
public MessageStatus Status { get; set; }
/// <summary>
/// The endpoint who sent the message
/// </summary>
public Endpoint SendingEndpoint { get; set; }
/// <summary>
/// The endpoint where the message failed to be processed
/// </summary>
public Endpoint ProcessingEndpoint { get; set; }
/// <summary>
/// Details about the reason for this particular failure
/// </summary>
public FailureInfo FailureDetails { get; set; }
/// <summary>
/// Details about the message itself.
/// </summary>
public Message MessageDetails { get; set; }
/// <summary>
/// Valid message statuses
/// </summary>
public enum MessageStatus
{
/// <summary>
/// Message has been archived
/// </summary>
ArchivedFailure,
/// <summary>
/// Message has failed
/// </summary>
Failed,
/// <summary>
/// Message had failed, was retried and has failed again
/// </summary>
RepeatedFailure
}
/// <summary>
/// Endpoint specific details
/// </summary>
public class Endpoint
{
/// <summary>
/// The name of the endpoint
/// </summary>
public string Name { get; set; }
/// <summary>
/// The unique identifier for the host that runs the endpoint
/// </summary>
public Guid HostId { get; set; }
/// <summary>
/// The name of the host
/// </summary>
public string Host { get; set; }
}
/// <summary>
/// Message details
/// </summary>
public class Message
{
/// <summary>
/// The id of the message
/// </summary>
public string MessageId { get; set; }
/// <summary>
/// The headers of the message
/// </summary>
public Dictionary<string, string> Headers { get; set; }
/// <summary>
/// The content type of the body
/// </summary>
public string ContentType { get; set; }
/// <summary>
/// The body for non-binary messages
/// </summary>
public string Body { get; set; }
}
/// <summary>
/// Information about the failure
/// </summary>
public class FailureInfo
{
/// <summary>
/// The physical address of the host where the message has failed
/// </summary>
public string AddressOfFailingEndpoint { get; set; }
/// <summary>
/// The time when the message has failed
/// </summary>
public DateTime TimeOfFailure { get; set; }
/// <summary>
/// The exception that caused this failure
/// </summary>
public ExceptionInfo Exception { get; set; }
/// <summary>
/// Exception details
/// </summary>
public class ExceptionInfo
{
/// <summary>
/// The CLR type of the exception
/// </summary>
public string ExceptionType { get; set; }
/// <summary>
/// The exception message
/// </summary>
public string Message { get; set; }
/// <summary>
/// The exception source
/// </summary>
public string Source { get; set; }
/// <summary>
/// The exception stack trace
/// </summary>
public string StackTrace { get; set; }
}
}
}
}