58 lines
1.4 KiB
Go
58 lines
1.4 KiB
Go
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{}
|
|
}
|