feat: add application queue priority routing

This commit is contained in:
hectorzhao
2026-07-07 14:49:10 +08:00
parent 72f2c010ce
commit 4c8f7dd73f
17 changed files with 392 additions and 46 deletions
+1
View File
@@ -34,6 +34,7 @@ type SubmitCommand struct {
Signature string `json:"signature"`
TemplateID string `json:"templateId"`
BillingUnits int `json:"billingUnits"`
QueuePriority string `json:"queuePriority"`
Route Route `json:"route"`
CMPP CMPP `json:"cmpp"`
Retry Retry `json:"retry"`
+50
View File
@@ -0,0 +1,50 @@
package queue
import (
"encoding/json"
"testing"
)
func TestSubmitCommandUnmarshalsQueuePriority(t *testing.T) {
payload := []byte(`{
"schemaVersion": "v1",
"messageType": "SubmitCommand",
"traceId": "trace-queue-0001",
"messageId": "msg-queue-0001",
"channelId": "channel-1",
"createdAt": "2026-07-07T10:00:00Z",
"tenantId": "tenant-1",
"applicationId": "app-1",
"submitId": "submit-1",
"phoneNumber": "13800138000",
"content": "hello",
"signature": "测试",
"templateId": "tpl-1",
"billingUnits": 1,
"queuePriority": "priority",
"route": {
"channelCode": "CMPP-A",
"cmppAccountCode": "account-a",
"priority": 1,
"rateLimitPerSecond": 100
},
"cmpp": {
"serviceId": "SMS",
"srcId": "10690000",
"registeredDelivery": 1,
"msgFmt": 8
},
"retry": {
"attempt": 0,
"maxAttempts": 3
}
}`)
var command SubmitCommand
if err := json.Unmarshal(payload, &command); err != nil {
t.Fatalf("unmarshal submit command: %v", err)
}
if command.QueuePriority != "priority" {
t.Fatalf("QueuePriority = %q, want priority", command.QueuePriority)
}
}