cmq

package
v0.0.0-...-979704d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const ActionReceiveMessage = "ReceiveMessage"
View Source
const ActionSendMessage = "SendMessage"
View Source
const Path = "/v2/index.php"

PATH 接口路径

Variables

This section is empty.

Functions

func MakeParamStr

func MakeParamStr(params interface{}) string

MakeParamStr 构建提交参数的字符串

func MakeSignPlainText

func MakeSignPlainText(
	params interface{},
	method string,
	host string,
	path string,
) string

MakeSignPlainText

func Sign

func Sign(signatureMethod string, secretKey string, data []byte) (signature string)

Sign 对数据进行签名

Types

type Account

type Account struct {
	// contains filtered or unexported fields
}

Account CMQ服务账号

func NewAccount

func NewAccount(host string, secretID string, secretKey string) *Account

NewAccount 创建Account实例

func (*Account) GetQueue

func (account *Account) GetQueue(queueName string) *Queue

GetQueue 获取队列实例

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client CMQ客户端

func NewClient

func NewClient(host string, secretID string, secretKey string) *Client

NewClient 创建新的Client实例

func (*Client) ReceiveMessage

func (client *Client) ReceiveMessage(params interface{}) (ReceiveMessageResp, error)

ReceiveMessage 发送消息到队列

func (*Client) SendMessage

func (client *Client) SendMessage(params interface{}) (SendMessageResp, error)

SendMessage 发送消息到队列

type Params

type Params struct {
	Action          string `json:"action"`
	Nonce           int64  `json:"Nonce"`
	RequestClient   string `json:"RequestClient"`
	SecretID        string `json:"secretId"`
	SignatureMethod string `json:"signatureMethod"`
	Signature       string `json:"signature"`
	Timestamp       int64  `json:"Timestamp"`
}

Params CMQ接口信息的数据结构

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue(queueName string, client *Client, encoding bool) *Queue

NewQueue 构建队列实例

func (*Queue) ReceiveMessage

func (queue *Queue) ReceiveMessage(pollingWaitSeconds int64) (ReceiveMessageResp, error)

ReceiveMessage 从队列消费消息

func (*Queue) SendMessage

func (queue *Queue) SendMessage(msg interface{}, delay int64) (SendMessageResp, error)

SendMessage 发送信息到队列

type QueueMessage

type QueueMessage struct {
	QueueName    string      `json:"queueName"`
	MsgBody      interface{} `json:"msgBody"`
	DelaySeconds int64       `json:"delaySeconds"`
}

type ReceiveMessage

type ReceiveMessage struct {
	QueueName          string `json:"queueName"`
	PollingWaitSeconds int64  `json:"pollingWaitSeconds"`
}

type ReceiveMessageParam

type ReceiveMessageParam struct {
	Params
	ReceiveMessage
}

type ReceiveMessageResp

type ReceiveMessageResp struct {
	SendMessageResp
	MsgBody          string `json:"msgBody"`
	ReceiptHandle    string `json:"receiptHandle"`
	EnqueueTime      int64  `json:"enqueueTime"`
	FirstDequeueTime int64  `json:"firstDequeueTime"`
	NextVisibleTime  int64  `json:"nextVisibleTime"`
	DequeueCount     int64  `json:"dequeueCount"`
}

ReceiveMessageResp 接受消息返回的数据结构

type SendMessageParam

type SendMessageParam struct {
	Params
	QueueMessage
}

type SendMessageResp

type SendMessageResp struct {
	Code      int64  `json:"code"`
	Message   string `json:"message"`
	MsgID     string `json:"msgId"`
	RequestID string `json:"requestId"`
}

SendMessageResp 发送消息返回的数据解雇

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL