feat: improve channel resilience and operations
This commit is contained in:
@@ -7,11 +7,12 @@ const SchemaVersion = "v1"
|
||||
type MessageType string
|
||||
|
||||
const (
|
||||
MessageTypeSubmitCommand MessageType = "SubmitCommand"
|
||||
MessageTypeSubmitResult MessageType = "SubmitResult"
|
||||
MessageTypeReceiptEvent MessageType = "ReceiptEvent"
|
||||
MessageTypeUplinkEvent MessageType = "UplinkEvent"
|
||||
MessageTypeConnectChannel MessageType = "ConnectChannel"
|
||||
MessageTypeSubmitCommand MessageType = "SubmitCommand"
|
||||
MessageTypeSubmitResult MessageType = "SubmitResult"
|
||||
MessageTypeReceiptEvent MessageType = "ReceiptEvent"
|
||||
MessageTypeUplinkEvent MessageType = "UplinkEvent"
|
||||
MessageTypeConnectChannel MessageType = "ConnectChannel"
|
||||
MessageTypeDisconnectChannel MessageType = "DisconnectChannel"
|
||||
)
|
||||
|
||||
type Envelope struct {
|
||||
@@ -60,13 +61,15 @@ type CMPP struct {
|
||||
}
|
||||
|
||||
type UpstreamConfig struct {
|
||||
GatewayHost string `json:"gatewayHost"`
|
||||
GatewayPort int `json:"gatewayPort"`
|
||||
Account string `json:"account"`
|
||||
PasswordCipher string `json:"passwordCipher"`
|
||||
CMPPVersion string `json:"cmppVersion"`
|
||||
DesiredConnections int `json:"desiredConnections,omitempty"`
|
||||
WindowSize int `json:"windowSize,omitempty"`
|
||||
GatewayHost string `json:"gatewayHost"`
|
||||
GatewayPort int `json:"gatewayPort"`
|
||||
Account string `json:"account"`
|
||||
PasswordCipher string `json:"passwordCipher"`
|
||||
CMPPVersion string `json:"cmppVersion"`
|
||||
DesiredConnections int `json:"desiredConnections,omitempty"`
|
||||
WindowSize int `json:"windowSize,omitempty"`
|
||||
HeartbeatIntervalSeconds int `json:"heartbeatIntervalSeconds,omitempty"`
|
||||
HeartbeatMissThreshold int `json:"heartbeatMissThreshold,omitempty"`
|
||||
}
|
||||
|
||||
type Retry struct {
|
||||
@@ -76,12 +79,12 @@ type Retry struct {
|
||||
|
||||
type SubmitResult struct {
|
||||
Envelope
|
||||
SequenceID uint32 `json:"sequenceId"`
|
||||
GatewayMessageID string `json:"gatewayMessageId"`
|
||||
SubmitStatus string `json:"submitStatus"`
|
||||
ErrorCode string `json:"errorCode,omitempty"`
|
||||
ErrorMessage string `json:"errorMessage,omitempty"`
|
||||
SubmittedAt time.Time `json:"submittedAt"`
|
||||
SequenceID uint32 `json:"sequenceId"`
|
||||
GatewayMessageID string `json:"gatewayMessageId"`
|
||||
SubmitStatus string `json:"submitStatus"`
|
||||
ErrorCode string `json:"errorCode,omitempty"`
|
||||
ErrorMessage string `json:"errorMessage,omitempty"`
|
||||
SubmittedAt time.Time `json:"submittedAt"`
|
||||
Segments []SubmitSegmentResult `json:"segments,omitempty"`
|
||||
}
|
||||
|
||||
@@ -129,13 +132,26 @@ type ConnectChannelCommand struct {
|
||||
}
|
||||
|
||||
type ConnectChannelConfig struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
GatewayHost string `json:"gatewayHost"`
|
||||
GatewayPort int `json:"gatewayPort"`
|
||||
Account string `json:"account"`
|
||||
PasswordCipher string `json:"passwordCipher"`
|
||||
SrcID string `json:"srcId"`
|
||||
CMPPVersion string `json:"cmppVersion"`
|
||||
RateLimitPerSecond int `json:"rateLimitPerSecond"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
GatewayHost string `json:"gatewayHost"`
|
||||
GatewayPort int `json:"gatewayPort"`
|
||||
Account string `json:"account"`
|
||||
PasswordCipher string `json:"passwordCipher"`
|
||||
SrcID string `json:"srcId"`
|
||||
CMPPVersion string `json:"cmppVersion"`
|
||||
RateLimitPerSecond int `json:"rateLimitPerSecond"`
|
||||
WindowSize int `json:"windowSize,omitempty"`
|
||||
HeartbeatIntervalSeconds int `json:"heartbeatIntervalSeconds,omitempty"`
|
||||
HeartbeatMissThreshold int `json:"heartbeatMissThreshold,omitempty"`
|
||||
}
|
||||
|
||||
type DisconnectChannelCommand struct {
|
||||
SchemaVersion string `json:"schemaVersion"`
|
||||
MessageType MessageType `json:"messageType"`
|
||||
TraceID string `json:"traceId"`
|
||||
ChannelID string `json:"channelId"`
|
||||
ConnectionID string `json:"connectionId"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user