| 1 |
package mq |
| 2 |
|
| 3 |
var newline string = "\n" |
| 4 |
|
| 5 |
type SendMessage struct { |
| 6 |
Topic string |
| 7 |
Tag string |
| 8 |
ProducerId string |
| 9 |
Key string |
| 10 |
Body string |
| 11 |
Time int64 |
| 12 |
} |
| 13 |
|
| 14 |
type Messages struct { |
| 15 |
Topic string |
| 16 |
Tag string |
| 17 |
ConsumerId string |
| 18 |
Time int64 |
| 19 |
} |
| 20 |
|
| 21 |
type Message struct { |
| 22 |
Body string `json:"body"` |
| 23 |
BornTime string `json:"bornTime"` |
| 24 |
Key string `json:"key"` |
| 25 |
MsgHandle string `json:"msgHandle"` |
| 26 |
MsgId string `json:"msgId"` |
| 27 |
ReconsumeTimes int `json:"reconsumeTimes"` |
| 28 |
Tag string `json:"tag"` |
| 29 |
} |
| 30 |
|
| 31 |
者状态码 |
| 32 |
func getStatusCodeMessage(statusCode int) string { |
| 33 |
switch statusCode { |
| 34 |
case 200: |
| 35 |
return "" |
| 36 |
case 201: |
| 37 |
return "" |
| 38 |
case 204: |
| 39 |
return "" |
| 40 |
case 400: |
| 41 |
return "Bad Request" |
| 42 |
case 403: |
| 43 |
return "Authentication Failed" |
| 44 |
case 408: |
| 45 |
return "Request Timeout" |
| 46 |
default: |
| 47 |
return "Unknown Error" |
| 48 |
} |
| 49 |
} |