✨ Update dependencies, enhance NATS consumer configuration, and improve error handling in message processing. Introduce telemetry support with OpenTelemetry for tracing and metrics. Refactor README to include new configuration options and update tests for improved coverage of error scenarios.
This commit is contained in:
@@ -84,6 +84,18 @@ DispatchedAt: time.Time{}.
|
||||
NeedDispatch: false.
|
||||
*/
|
||||
|
||||
// ParsedMessage holds the parsed data from an aviation message
|
||||
type MessageStatus string
|
||||
|
||||
const (
|
||||
MessageStatusUnknown MessageStatus = "unknown"
|
||||
MessageStatusParsed MessageStatus = "parsed"
|
||||
MessageStatusHeaderError MessageStatus = "header_error"
|
||||
MessageStatusBodyError MessageStatus = "body_error"
|
||||
MessageStatusRepositoryFail MessageStatus = "repository_error"
|
||||
MessageStatusPublishFail MessageStatus = "publish_error"
|
||||
)
|
||||
|
||||
// ParsedMessage holds the parsed data from an aviation message
|
||||
type ParsedMessage struct {
|
||||
// StartIndicator string `json:"startIndicator"` // 电报开始标识: The start of the message indicator (e.g., 'ZCZC').
|
||||
@@ -105,7 +117,8 @@ type ParsedMessage struct {
|
||||
NeedDispatch bool `json:"needDispatch"` // 需要分发: Indicates if the message needs to be dispatched.
|
||||
Parsed bool `json:"parsed"` // 解析: Indicates if the message has been parsed.
|
||||
Comments string `json:"comments,omitempty"` // 备注: Additional comments.
|
||||
|
||||
Status MessageStatus
|
||||
ErrorReason string `json:"errorReason,omitempty"`
|
||||
}
|
||||
|
||||
// NewParsedMessage initializes a ParsedMessage with default values
|
||||
@@ -113,6 +126,7 @@ func NewParsedMessage() *ParsedMessage {
|
||||
return &ParsedMessage{
|
||||
// SecondaryAddresses: []string{},
|
||||
Parsed: false,
|
||||
Status: MessageStatusUnknown,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user