初始化项目
This commit is contained in:
109
trunk/framework/mqMgr/model/common_request.go
Normal file
109
trunk/framework/mqMgr/model/common_request.go
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
请求结构简介
|
||||
最近更新时间:2019-08-01 19:14:44
|
||||
|
||||
编辑 查看pdf
|
||||
在这篇文章中:
|
||||
服务地址
|
||||
通信协议
|
||||
请求方法
|
||||
请求参数
|
||||
字符编码
|
||||
对腾讯云的 API 接口的调用是通过向腾讯云 API 的服务端地址发送请求,并按照接口说明在请求中加入相应的请求参数来完成的。腾讯云 API 的请求结构由:服务地址、通信协议、请求方法、请求参数和字符编码组成。具体描述如下:
|
||||
|
||||
服务地址
|
||||
腾讯云 API 的服务接入地址与具体模块相关,详细请参见各接口相关描述。
|
||||
|
||||
通信协议
|
||||
腾讯云 API 的大部分接口都通过 HTTPS 进行通信,为您提供高安全性的通信通道。
|
||||
|
||||
请求方法
|
||||
腾讯云 API 同时支持 POST 和 GET 请求。
|
||||
|
||||
注意:
|
||||
|
||||
POST 和 GET 请求不能混合使用,若使用 GET 方式,则参数均从 Querystring 取得;
|
||||
若使用 POST 方式,则参数均从 Request Body 中取得,而 Querystring 中的参数将忽略。
|
||||
两种请求方式的参数格式规则相同,一般情况下使用 GET 请求,当参数字符串过长时推荐使用 POST。
|
||||
如果用户的请求方法是 GET,则对所有请求参数值均需要做 URL 编码,若为 POST,则无需对参数编码。
|
||||
GET 请求的最大长度根据不同的浏览器和服务器设置有所不同,例如,传统 IE 浏览器限制为 2K,Firefox 限制为 8K;对于一些参数较多、长度较长的 API 请求,建议您使用 POST 方法以免在请求过程中会由于字符串超过最大长度而导致请求失败。
|
||||
对于 POST 请求,您需要使用 x-www-form-urlencoded 的形式传参,因为云 API 侧是从 $_POST 中取出请求参数的。
|
||||
请求参数
|
||||
腾讯云 API 的每个请求都需要指定两类参数:公共请求参数以及接口请求参数。其中公共请求参数是每个接口都要用到的请求参数,具体可参见 公共请求参数,而接口请求参数是各个接口所特有的,具体见各个接口的“请求参数”描述。
|
||||
|
||||
字符编码
|
||||
腾讯云 API 的请求及返回结果均使用 UTF-8 字符集进行编码。
|
||||
*/
|
||||
package model
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"goutil/mathUtil"
|
||||
)
|
||||
|
||||
// CommonRequest 公共请求参数对象
|
||||
type CommonRequest struct {
|
||||
// Action 指令接口名称(必须)
|
||||
Action string
|
||||
|
||||
// 地域参数(必须)
|
||||
Region string
|
||||
|
||||
// Timestamp 当前UNIX时间戳(必须)
|
||||
Timestamp uint64
|
||||
|
||||
// Nonce 随机正整数(必须)
|
||||
Nonce uint32
|
||||
|
||||
// SecretId 在云API密钥上申请的标识身份的SecretId(必须)
|
||||
SecretId string
|
||||
|
||||
// 请求签名,用来验证此次请求的合法性,需要用户根据实际的输入参数计算得出。
|
||||
Signature string
|
||||
|
||||
// 签名方式,目前支持 HmacSHA256 和 HmacSHA1。只有指定此参数为 HmacSHA256 时,才使用 HmacSHA256 算法验证签名,其他情况均使用 HmacSHA1 验证签名。
|
||||
SignatureMethod string
|
||||
|
||||
// 队列名称(此属性虽然不是API文档中的公共属性,但是在队列模型中确实事实上的公共属性,所以将其转移到此处)
|
||||
queueName string
|
||||
}
|
||||
|
||||
// AssembleParamMap 组装请求参数字典
|
||||
// 返回值
|
||||
// map[string]interface{}:请求参数字
|
||||
func (this *CommonRequest) AssembleParamMap() map[string]string {
|
||||
result := make(map[string]string)
|
||||
|
||||
// 组装参数
|
||||
result["Action"] = this.Action
|
||||
result["Region"] = this.Region
|
||||
result["Timestamp"] = fmt.Sprintf("%d", this.Timestamp)
|
||||
result["Nonce"] = fmt.Sprintf("%d", this.Nonce)
|
||||
result["SecretId"] = this.SecretId
|
||||
result["SignatureMethod"] = this.SignatureMethod
|
||||
result["queueName"] = this.queueName
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// NewCommonRequest 新建公共请求参数对象
|
||||
// 参数
|
||||
// action:指令接口名称
|
||||
// region:地域
|
||||
// secretId:在云API密钥上申请的标识身份的SecretId
|
||||
// queueName:队列名称
|
||||
// 返回值
|
||||
// *CommonRequest:公共请求参数对象
|
||||
func NewCommonRequest(action, region, secretId, queueName string) *CommonRequest {
|
||||
return &CommonRequest{
|
||||
Action: action,
|
||||
Region: region,
|
||||
Timestamp: uint64(time.Now().Unix()),
|
||||
Nonce: mathUtil.GetRand().Uint32(),
|
||||
SecretId: secretId,
|
||||
SignatureMethod: "HmacSHA256",
|
||||
queueName: queueName,
|
||||
}
|
||||
}
|
||||
28
trunk/framework/mqMgr/model/common_response.go
Normal file
28
trunk/framework/mqMgr/model/common_response.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package model
|
||||
|
||||
// CommonResponse 公共请求结果对象
|
||||
type CommonResponse struct {
|
||||
// 错误码
|
||||
Code ResultStatus `json:"code"`
|
||||
|
||||
// 错误提示信息
|
||||
Message string `json:"message"`
|
||||
|
||||
// 服务器生成的请求Id
|
||||
RequestId string `json:"requestId"`
|
||||
}
|
||||
|
||||
// IsSuccess 请求结果是否成功
|
||||
func (this *CommonResponse) IsSuccess() bool {
|
||||
return this.Code == Success
|
||||
}
|
||||
|
||||
// IsFailure 请求结果是否失败
|
||||
func (this *CommonResponse) IsFailure() bool {
|
||||
return this.Code != Success
|
||||
}
|
||||
|
||||
// HasMessage 请求结果是否有信息
|
||||
func (this *CommonResponse) HaveNoMessage() bool {
|
||||
return this.Code == NoMessage
|
||||
}
|
||||
13
trunk/framework/mqMgr/model/errorInfo.go
Normal file
13
trunk/framework/mqMgr/model/errorInfo.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package model
|
||||
|
||||
// 错误信息对象
|
||||
type ErrorInfo struct {
|
||||
// 错误码
|
||||
Code int `json:"code"`
|
||||
|
||||
// 错误提示信息
|
||||
Message string `json:"message"`
|
||||
|
||||
// 对应删除失败的消息句柄
|
||||
ReceiptHandle string `json:"receiptHandle"`
|
||||
}
|
||||
13
trunk/framework/mqMgr/model/irequest.go
Normal file
13
trunk/framework/mqMgr/model/irequest.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package model
|
||||
|
||||
// IRequest 请求对象接口
|
||||
type IRequest interface {
|
||||
// GetActionName 获取方法名
|
||||
GetActionName() string
|
||||
|
||||
// SetCommonRequestObject 设置公共请求对象
|
||||
SetCommonRequest(*CommonRequest)
|
||||
|
||||
// AssembleParamMap 组装参数字典
|
||||
AssembleParamMap() map[string]string
|
||||
}
|
||||
25
trunk/framework/mqMgr/model/messageInfo.go
Normal file
25
trunk/framework/mqMgr/model/messageInfo.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package model
|
||||
|
||||
// 消息对象
|
||||
type MessageInfo struct {
|
||||
// 本次消费的消息正文
|
||||
MsgBody string `json:"msgBody"`
|
||||
|
||||
// 服务器生成消息的唯一标识Id
|
||||
MsgId string `json:"msgId"`
|
||||
|
||||
// 每次消费返回唯一的消息句柄。用于删除该消息,仅上一次消费时产生的消息句柄能用于删除消息。
|
||||
ReceiptHandle string `json:"receiptHandle"`
|
||||
|
||||
// 消费被生产出来,进入队列的时间
|
||||
EnqueueTime int64 `json:"enqueueTime"`
|
||||
|
||||
// 第一次消费该消息的时间
|
||||
FirstDequeueTime int64 `json:"firstDequeueTime"`
|
||||
|
||||
// 消息的下次可见(可再次被消费)时间
|
||||
NextVisibleTime int64 `json:"nextVisibleTime"`
|
||||
|
||||
// 消息被消费的次数
|
||||
DequeueCount int64 `json:"dequeueCount"`
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// 批量删除消息请求对象
|
||||
type BatchDeleteMessageRequest struct {
|
||||
// 公共请求参数
|
||||
common *CommonRequest
|
||||
|
||||
// 上次消费消息时返回的消息句柄列表
|
||||
receiptHandleList []string
|
||||
}
|
||||
|
||||
// 获取请求方法名
|
||||
func (this *BatchDeleteMessageRequest) GetActionName() string {
|
||||
return "BatchDeleteMessage"
|
||||
}
|
||||
|
||||
// SetCommonRequestObject 设置公共请求对象
|
||||
func (this *BatchDeleteMessageRequest) SetCommonRequest(commonRequest *CommonRequest) {
|
||||
this.common = commonRequest
|
||||
}
|
||||
|
||||
// AssembleParamMap 组装参数字典
|
||||
// 返回值
|
||||
// map[string]string:请求参数字典
|
||||
func (this *BatchDeleteMessageRequest) AssembleParamMap() map[string]string {
|
||||
paramMap := this.common.AssembleParamMap()
|
||||
for index, msg := range this.receiptHandleList {
|
||||
key := fmt.Sprintf("receiptHandle.%d", index)
|
||||
paramMap[key] = msg
|
||||
}
|
||||
|
||||
return paramMap
|
||||
}
|
||||
|
||||
func NewBatchDeleteMessageRequest(receiptHandleList []string) *BatchDeleteMessageRequest {
|
||||
return &BatchDeleteMessageRequest{
|
||||
receiptHandleList: receiptHandleList,
|
||||
}
|
||||
}
|
||||
|
||||
// 批量删除消息请求返回结果对象
|
||||
type BatchDeleteMessageResponse struct {
|
||||
*CommonResponse
|
||||
|
||||
// 无法成功删除的错误列表
|
||||
ErrorList []*ErrorInfo `json:"errorList"`
|
||||
}
|
||||
|
||||
func NewBatchDeleteMessageResponse() *BatchDeleteMessageResponse {
|
||||
return &BatchDeleteMessageResponse{}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// 批量消费消息请求对象
|
||||
type BatchReceiveMessageRequest struct {
|
||||
// 公共请求参数
|
||||
common *CommonRequest
|
||||
|
||||
// 本次消费的消息数量。取值范围 1-16。(必须)
|
||||
numOfMsg int
|
||||
|
||||
// 本次请求的长轮询等待时间(非必须)
|
||||
pollingWaitSeconds int
|
||||
}
|
||||
|
||||
// 获取请求方法名
|
||||
func (this *BatchReceiveMessageRequest) GetActionName() string {
|
||||
return "BatchReceiveMessage"
|
||||
}
|
||||
|
||||
// SetCommonRequest 设置公共请求对象
|
||||
func (this *BatchReceiveMessageRequest) SetCommonRequest(commonRequest *CommonRequest) {
|
||||
this.common = commonRequest
|
||||
}
|
||||
|
||||
// AssembleParamMap 组装参数字典
|
||||
// 返回值
|
||||
// map[string]string:请求参数字典
|
||||
func (this *BatchReceiveMessageRequest) AssembleParamMap() map[string]string {
|
||||
paramMap := this.common.AssembleParamMap()
|
||||
paramMap["numOfMsg"] = fmt.Sprintf("%d", this.numOfMsg)
|
||||
paramMap["pollingWaitSeconds"] = fmt.Sprintf("%d", this.pollingWaitSeconds)
|
||||
|
||||
return paramMap
|
||||
}
|
||||
|
||||
func NewBatchReceiveMessageRequest(numOfMsg, pollingWaitSeconds int) *BatchReceiveMessageRequest {
|
||||
return &BatchReceiveMessageRequest{
|
||||
numOfMsg: numOfMsg,
|
||||
pollingWaitSeconds: pollingWaitSeconds,
|
||||
}
|
||||
}
|
||||
|
||||
// 批量消费消息请求返回结果对象
|
||||
type BatchReceiveMessageResponse struct {
|
||||
*CommonResponse
|
||||
|
||||
// message信息列表
|
||||
MsgInfoList []*MessageInfo `json:"msgInfoList"`
|
||||
}
|
||||
|
||||
func NewBatchReceiveMessageResponse() *BatchReceiveMessageResponse {
|
||||
return &BatchReceiveMessageResponse{}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// 批量发送消息请求对象
|
||||
type BatchSendMessageRequest struct {
|
||||
// 公共请求参数
|
||||
common *CommonRequest
|
||||
|
||||
// 消息正文列表
|
||||
msgBodyList []string
|
||||
|
||||
// 单位为秒,表示该消息发送到队列后,需要延时多久用户才可见该消息。
|
||||
delaySeconds int
|
||||
}
|
||||
|
||||
// 获取请求方法名
|
||||
func (this *BatchSendMessageRequest) GetActionName() string {
|
||||
return "BatchSendMessage"
|
||||
}
|
||||
|
||||
// SetCommonRequest 设置公共请求对象
|
||||
func (this *BatchSendMessageRequest) SetCommonRequest(commonRequest *CommonRequest) {
|
||||
this.common = commonRequest
|
||||
}
|
||||
|
||||
// AssembleParamMap 组装参数字典
|
||||
// 返回值
|
||||
// map[string]string:请求参数字典
|
||||
func (this *BatchSendMessageRequest) AssembleParamMap() map[string]string {
|
||||
paramMap := this.common.AssembleParamMap()
|
||||
for index, msg := range this.msgBodyList {
|
||||
key := fmt.Sprintf("msgBody.%d", index)
|
||||
paramMap[key] = msg
|
||||
}
|
||||
paramMap["delaySeconds"] = fmt.Sprintf("%d", this.delaySeconds)
|
||||
|
||||
return paramMap
|
||||
}
|
||||
|
||||
func NewBatchSendMessageRequest(msgBodyList []string, delaySeconds int) *BatchSendMessageRequest {
|
||||
return &BatchSendMessageRequest{
|
||||
msgBodyList: msgBodyList,
|
||||
delaySeconds: delaySeconds,
|
||||
}
|
||||
}
|
||||
|
||||
// 批量发送消息请求返回结果对象
|
||||
type BatchSendMessageResponse struct {
|
||||
*CommonResponse
|
||||
|
||||
// message信息列表
|
||||
MsgInfoList []*MessageInfo `json:"msgInfoList"`
|
||||
}
|
||||
|
||||
func NewBatchSendMessageResponse() *BatchSendMessageResponse {
|
||||
return &BatchSendMessageResponse{}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package model
|
||||
|
||||
// 删除消息请求对象l
|
||||
type DeleteMessageRequest struct {
|
||||
// 公共请求参数
|
||||
common *CommonRequest
|
||||
|
||||
// 上次消费返回唯一的消息句柄,用于删除消息。(必须)
|
||||
receiptHandle string
|
||||
}
|
||||
|
||||
// 获取请求方法名
|
||||
func (this *DeleteMessageRequest) GetActionName() string {
|
||||
return "DeleteMessage"
|
||||
}
|
||||
|
||||
// SetCommonRequest 设置公共请求对象
|
||||
func (this *DeleteMessageRequest) SetCommonRequest(commonRequest *CommonRequest) {
|
||||
this.common = commonRequest
|
||||
}
|
||||
|
||||
// AssembleParamMap 组装参数字典
|
||||
// 返回值
|
||||
// map[string]string:请求参数字典
|
||||
func (this *DeleteMessageRequest) AssembleParamMap() map[string]string {
|
||||
paramMap := this.common.AssembleParamMap()
|
||||
paramMap["receiptHandle"] = this.receiptHandle
|
||||
|
||||
return paramMap
|
||||
}
|
||||
|
||||
func NewDeleteMessageRequest(receiptHandle string) *DeleteMessageRequest {
|
||||
return &DeleteMessageRequest{
|
||||
receiptHandle: receiptHandle,
|
||||
}
|
||||
}
|
||||
|
||||
// 删除消息请求返回结果对象
|
||||
type DeleteMessageResponse struct {
|
||||
// 公共请求结果
|
||||
*CommonResponse
|
||||
}
|
||||
|
||||
func NewDeleteMessageResponse() *DeleteMessageResponse {
|
||||
return &DeleteMessageResponse{}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package model
|
||||
|
||||
// 消费消息请求对象
|
||||
type GetQueueAttributesRequest struct {
|
||||
// 公共请求参数
|
||||
common *CommonRequest
|
||||
}
|
||||
|
||||
// 获取请求方法名
|
||||
func (this *GetQueueAttributesRequest) GetActionName() string {
|
||||
return "GetQueueAttributes"
|
||||
}
|
||||
|
||||
// SetCommonRequestObject 设置公共请求对象
|
||||
func (this *GetQueueAttributesRequest) SetCommonRequest(commonRequest *CommonRequest) {
|
||||
this.common = commonRequest
|
||||
}
|
||||
|
||||
// AssembleParamMap 组装参数字典
|
||||
// 返回值
|
||||
// map[string]string:请求参数字典
|
||||
func (this *GetQueueAttributesRequest) AssembleParamMap() map[string]string {
|
||||
paramMap := this.common.AssembleParamMap()
|
||||
|
||||
return paramMap
|
||||
}
|
||||
|
||||
func NewGetQueueAttributesRequest() *GetQueueAttributesRequest {
|
||||
return &GetQueueAttributesRequest{}
|
||||
}
|
||||
|
||||
// 消费消息请求返回结果对象
|
||||
type GetQueueAttributesResponse struct {
|
||||
*CommonResponse
|
||||
|
||||
MaxMsgHeapNum int `json:"maxMsgHeapNum"` // 最大堆积消息数。取值范围在公测期间为 1,000,000 - 10,000,000,正式上线后范围可达到 1000,000-1000,000,000。默认取值在公测期间为 10,000,000,正式上线后为 100,000,000。
|
||||
PollingWaitSeconds int `json:"pollingWaitSeconds"` // 消息接收长轮询等待时间。取值范围0 - 30秒,默认值0。
|
||||
VisibilityTimeout int `json:"visibilityTimeout"` // 消息可见性超时。取值范围1 - 43200秒(即12小时内),默认值30。
|
||||
MaxMsgSize int `json:"maxMsgSize"` // 消息最大长度。取值范围1024 - 1048576 Byte(即1K - 1024K),默认值65536。
|
||||
MsgRetentionSeconds int `json:"msgRetentionSeconds"` // 消息保留周期。取值范围60-1296000秒(1min-15天),默认值345600秒(4 天)。
|
||||
CreateTime int `json:"createTime"` // 队列的创建时间。返回 Unix 时间戳,精确到秒。
|
||||
LastModifyTime int `json:"lastModifyTime"` // 最后一次修改队列属性的时间。返回 Unix 时间戳,精确到秒。
|
||||
ActiveMsgNum int `json:"activeMsgNum"` // 在队列中处于 Active 状态(不处于被消费状态)的消息总数,为近似值。
|
||||
InactiveMsgNum int `json:"inactiveMsgNum"` // 在队列中处于 Inactive 状态(正处于被消费状态)的消息总数,为近似值。
|
||||
RewindSeconds int `json:"rewindSeconds"` // 回溯队列的消息回溯时间最大值,取值范围0 - 43200秒,0表示不开启消息回溯。
|
||||
RewindmsgNum int `json:"rewindmsgNum"` // 已调用 DelMsg 接口删除,但还在回溯保留时间内的消息数量。
|
||||
MinMsgTime int `json:"minMsgTime"` // 消息最小未消费时间,单位为秒。
|
||||
QueueName string `json:"queueName"` // 消息队列名字。
|
||||
QueueId string `json:"queueId"` // 消息队列ID。
|
||||
CreateUin int64 `json:"createUin"` // 创建者Uin。
|
||||
Bps int `json:"Bps"` // 带宽限制。
|
||||
Qps int `json:"qps"` // 每秒钟生产消息条数的限制,消费消息的大小是该值的1.1倍。
|
||||
Tags []string `json:"tags"` // 关联的标签。
|
||||
}
|
||||
|
||||
func NewGetQueueAttributesResponse() *GetQueueAttributesResponse {
|
||||
return &GetQueueAttributesResponse{}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// 消费消息请求对象
|
||||
type ReceiveMessageRequest struct {
|
||||
// 公共请求参数
|
||||
common *CommonRequest
|
||||
|
||||
// 本次请求的长轮询等待时间。取值范围0 - 30秒,如果不设置该参数,则默认使用队列属性中的 pollingWaitSeconds 值。
|
||||
pollingWaitSeconds int
|
||||
}
|
||||
|
||||
// 获取请求方法名
|
||||
func (this *ReceiveMessageRequest) GetActionName() string {
|
||||
return "ReceiveMessage"
|
||||
}
|
||||
|
||||
// SetCommonRequestObject 设置公共请求对象
|
||||
func (this *ReceiveMessageRequest) SetCommonRequest(commonRequest *CommonRequest) {
|
||||
this.common = commonRequest
|
||||
}
|
||||
|
||||
// AssembleParamMap 组装参数字典
|
||||
// 返回值
|
||||
// map[string]string:请求参数字典
|
||||
func (this *ReceiveMessageRequest) AssembleParamMap() map[string]string {
|
||||
paramMap := this.common.AssembleParamMap()
|
||||
paramMap["pollingWaitSeconds"] = fmt.Sprintf("%d", this.pollingWaitSeconds)
|
||||
|
||||
return paramMap
|
||||
}
|
||||
|
||||
func NewReceiveMessageRequest(pollingWaitSeconds int) *ReceiveMessageRequest {
|
||||
return &ReceiveMessageRequest{
|
||||
pollingWaitSeconds: pollingWaitSeconds,
|
||||
}
|
||||
}
|
||||
|
||||
// 消费消息请求返回结果对象
|
||||
type ReceiveMessageResponse struct {
|
||||
*CommonResponse
|
||||
|
||||
// 消息对象
|
||||
*MessageInfo
|
||||
}
|
||||
|
||||
func NewReceiveMessageResponse() *ReceiveMessageResponse {
|
||||
return &ReceiveMessageResponse{}
|
||||
}
|
||||
58
trunk/framework/mqMgr/model/request_response_SendMessage.go
Normal file
58
trunk/framework/mqMgr/model/request_response_SendMessage.go
Normal file
@@ -0,0 +1,58 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// 发送消息请求对象
|
||||
type SendMessageRequest struct {
|
||||
// 公共请求参数
|
||||
common *CommonRequest
|
||||
|
||||
// 消息正文
|
||||
msgBody string
|
||||
|
||||
// 单位为秒,表示该消息发送到队列后,需要延时多久用户才可见该消息。
|
||||
delaySeconds int
|
||||
}
|
||||
|
||||
// 获取请求方法名
|
||||
func (this *SendMessageRequest) GetActionName() string {
|
||||
return "SendMessage"
|
||||
}
|
||||
|
||||
// SetCommonRequest 设置公共请求对象
|
||||
func (this *SendMessageRequest) SetCommonRequest(commonRequest *CommonRequest) {
|
||||
this.common = commonRequest
|
||||
}
|
||||
|
||||
// AssembleParamMap 组装参数字典
|
||||
// 返回值
|
||||
// map[string]string:请求参数字典
|
||||
func (this *SendMessageRequest) AssembleParamMap() map[string]string {
|
||||
paramMap := this.common.AssembleParamMap()
|
||||
paramMap["msgBody"] = this.msgBody
|
||||
paramMap["delaySeconds"] = fmt.Sprintf("%d", this.delaySeconds)
|
||||
|
||||
return paramMap
|
||||
}
|
||||
|
||||
func NewSendMessageRequest(msgBody string, delaySeconds int) *SendMessageRequest {
|
||||
return &SendMessageRequest{
|
||||
msgBody: msgBody,
|
||||
delaySeconds: delaySeconds,
|
||||
}
|
||||
}
|
||||
|
||||
// 发送消息请求返回结果对象
|
||||
type SendMessageResponse struct {
|
||||
// 公共请求结果
|
||||
*CommonResponse
|
||||
|
||||
// 服务器生成消息的唯一标识Id
|
||||
MsgId string `json:"msgId"`
|
||||
}
|
||||
|
||||
func NewSendMessageResponse() *SendMessageResponse {
|
||||
return &SendMessageResponse{}
|
||||
}
|
||||
9
trunk/framework/mqMgr/model/resultStatus.go
Normal file
9
trunk/framework/mqMgr/model/resultStatus.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package model
|
||||
|
||||
// 返回结果状态
|
||||
type ResultStatus int
|
||||
|
||||
const (
|
||||
Success = 0
|
||||
NoMessage = 7000
|
||||
)
|
||||
Reference in New Issue
Block a user