feat: add application queue priority routing
This commit is contained in:
@@ -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"`
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user