Documentation
¶
Index ¶
- Constants
- Variables
- func Sign(src, key, method string) string
- type Account
- func (this *Account) CreateQueue(queueName string, queueMeta QueueMeta) (err error, code int)
- func (this *Account) CreateSubscribe(topicName, subscriptionName, endpoint, protocol, notifyContentFormat string) (err error, code int)
- func (this *Account) CreateTopic(topicName string, maxMsgSize int) (err error, code int)
- func (this *Account) DeleteQueue(queueName string) (err error, code int)
- func (this *Account) DeleteSubscribe(topicName, subscriptionName string) (err error, code int)
- func (this *Account) DeleteTopic(topicName string) (err error, code int)
- func (this *Account) GetQueue(queueName string) (queue *Queue)
- func (this *Account) GetSubscription(topicName, subscriptionName string) *Subscription
- func (this *Account) GetTopic(topicName string) (topic *Topic)
- func (this *Account) ListQueue(searchWord string, offset, limit int) (totalCount int, queueList []string, err error, code int)
- func (this *Account) ListTopic(searchWord string, offset, limit int) (totalCount int, topicList []string, err error, code int)
- func (this *Account) SetProxy(proxyUrl string) *Account
- func (this *Account) SetTransport(transport http.RoundTripper) *Account
- func (this *Account) UnsetProxy() *Account
- type CMQClient
- type CMQHttp
- type CMQTool
- type Message
- type Queue
- func (this *Queue) BatchDeleteMessage(receiptHandles []string) (err error, code int)
- func (this *Queue) BatchReceiveMessage(numOfMsg, pollingWaitSeconds int) (msgs []Message, err error, code int)
- func (this *Queue) BatchSendDelayMessage(msgBodys []string, delaySeconds int) (messageIds []string, err error, code int)
- func (this *Queue) BatchSendMessage(msgBodys []string) (messageIds []string, err error, code int)
- func (this *Queue) DeleteMessage(receiptHandle string) (err error, code int)
- func (this *Queue) GetQueueAttributes() (queueMeta QueueMeta, err error, code int)
- func (this *Queue) ReceiveMessage(pollingWaitSeconds int) (msg Message, err error, code int)
- func (this *Queue) RewindQueue(backTrackingTime int) (err error, code int)
- func (this *Queue) SendDelayMessage(msgBody string, delaySeconds int) (messageId string, err error, code int)
- func (this *Queue) SendMessage(msgBody string) (messageId string, err error, code int)
- func (this *Queue) SetQueueAttributes(queueMeta QueueMeta) (err error, code int)
- type QueueMeta
- type Subscription
- type SubscriptionMeta
- type Topic
- func (this *Topic) BatchPublishMessage(msgList []string) (msgIds []string, err error, code int)
- func (this *Topic) GetTopicAttributes() (meta TopicMeta, err error, code int)
- func (this *Topic) ListSubscription(offset, limit int, searchWord string) (totalCount int, subscriptionList []string, err error, code int)
- func (this *Topic) PublishMessage(message string) (msgId string, err error, code int)
- func (this *Topic) SetTopicAttributes(maxMsgSize int) (err error, code int)
- type TopicMeta
Constants ¶
View Source
const ( /** 缺省消息接收长轮询等待时间 */ DEFAULT_POLLING_WAIT_SECONDS = 0 /** 缺省消息可见性超时 */ DEFAULT_VISIBILITY_TIMEOUT = 30 /** 缺省消息最大长度,单位字节 */ DEFAULT_MAX_MSG_SIZE = 1048576 /** 缺省消息保留周期,单位秒 */ DEFAULT_MSG_RETENTION_SECONDS = 345600 )
View Source
const ( NotifyStrategyDefault = "BACKOFF_RETRY" NotifyContentFormatDefault = "JSON" NotifyContentFormatSimplified = "SIMPLIFIED" )
View Source
const (
CURRENT_VERSION = "SDK_GO_1.3"
)
View Source
const (
DEFAULT_ERROR_CODE = -1
)
View Source
const (
DEFAULT_HTTP_TIMEOUT = 3000 //ms
)
View Source
const (
SIGN_ALGORITHM_SHA1 = "sha1"
)
Variables ¶
View Source
var DefaultTransport = &http.Transport{ Proxy: http.ProxyFromEnvironment, DialContext: (&net.Dialer{ Timeout: 30 * time.Second, KeepAlive: 30 * time.Second, DualStack: true, }).DialContext, MaxIdleConns: 500, MaxIdleConnsPerHost: 100, IdleConnTimeout: 90 * time.Second, TLSHandshakeTimeout: 10 * time.Second, ExpectContinueTimeout: 1 * time.Second, }
Functions ¶
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
func NewAccount ¶
func (*Account) CreateQueue ¶
func (*Account) CreateSubscribe ¶
func (*Account) CreateTopic ¶
func (*Account) DeleteQueue ¶
func (*Account) DeleteSubscribe ¶
func (*Account) DeleteTopic ¶
func (*Account) GetSubscription ¶
func (this *Account) GetSubscription(topicName, subscriptionName string) *Subscription
func (*Account) SetTransport ¶
func (this *Account) SetTransport(transport http.RoundTripper) *Account
func (*Account) UnsetProxy ¶
type CMQClient ¶
type CMQClient struct {
Endpoint string
Path string
SecretId string
SecretKey string
Method string
SignMethod string
CmqHttp *CMQHttp
}
func NewCMQClient ¶
type CMQHttp ¶
type CMQHttp struct {
// contains filtered or unexported fields
}
func NewCMQHttp ¶
func NewCMQHttp() *CMQHttp
func (*CMQHttp) SetTransport ¶
func (this *CMQHttp) SetTransport(transport http.RoundTripper)
type Message ¶
type Message struct {
/** 服务器返回的消息ID */
MsgId string
/** 每次消费唯一的消息句柄,用于删除等操作 */
ReceiptHandle string
/** 消息体 */
MsgBody string
/** 消息发送到队列的时间,从 1970年1月1日 00:00:00 000 开始的毫秒数 */
EnqueueTime int64
/** 消息下次可见的时间,从 1970年1月1日 00:00:00 000 开始的毫秒数 */
NextVisibleTime int64
/** 消息第一次出队列的时间,从 1970年1月1日 00:00:00 000 开始的毫秒数 */
FirstDequeueTime int64
/** 出队列次数 */
DequeueCount int
MsgTag []string
}
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
func (*Queue) BatchDeleteMessage ¶
func (*Queue) BatchReceiveMessage ¶
func (*Queue) BatchSendDelayMessage ¶
func (*Queue) BatchSendMessage ¶
func (*Queue) DeleteMessage ¶
func (*Queue) GetQueueAttributes ¶
func (*Queue) ReceiveMessage ¶
func (*Queue) RewindQueue ¶
func (*Queue) SendDelayMessage ¶
func (*Queue) SendMessage ¶
type QueueMeta ¶
type QueueMeta struct {
/** 最大堆积消息数 */
MaxMsgHeapNum int
/** 消息接收长轮询等待时间 */
PollingWaitSeconds int
/** 消息可见性超时 */
VisibilityTimeout int
/** 消息最大长度 */
MaxMsgSize int
/** 消息保留周期 */
MsgRetentionSeconds int
/** 队列创建时间 */
CreateTime int
/** 队列属性最后修改时间 */
LastModifyTime int
/** 队列处于Active状态的消息总数 */
ActiveMsgNum int
/** 队列处于Inactive状态的消息总数 */
InactiveMsgNum int
/** 已删除的消息,但还在回溯保留时间内的消息数量 */
RewindMsgNum int
/** 消息最小未消费时间 */
MinMsgTime int
/** 延时消息数量 */
DelayMsgNum int
/** 回溯时间 */
RewindSeconds int
}
type Subscription ¶
type Subscription struct {
// contains filtered or unexported fields
}
func NewSubscription ¶
func NewSubscription(topicName, subscriptionName string, client *CMQClient) *Subscription
func (*Subscription) ClearFilterTags ¶
func (this *Subscription) ClearFilterTags() (err error, code int)
func (*Subscription) GetSubscriptionAttributes ¶
func (this *Subscription) GetSubscriptionAttributes() (meta *SubscriptionMeta, err error, code int)
func (*Subscription) SetSubscriptionAttributes ¶
func (this *Subscription) SetSubscriptionAttributes(meta SubscriptionMeta) (err error, code int)
type SubscriptionMeta ¶
type SubscriptionMeta struct {
//Subscription 订阅的主题所有者的appId
TopicOwner string
//订阅的终端地址
Endpoint string
//订阅的协议
Protocal string
//推送消息出现错误时的重试策略
NotifyStrategy string
//向 Endpoint 推送的消息内容格式
NotifyContentFormat string
//描述了该订阅中消息过滤的标签列表(仅标签一致的消息才会被推送)
FilterTag []string
//Subscription 的创建时间,从 1970-1-1 00:00:00 到现在的秒值
CreateTime int
//修改 Subscription 属性信息最近时间,从 1970-1-1 00:00:00 到现在的秒值
LastModifyTime int
//该订阅待投递的消息数
MsgCount int
BindingKey []string
}
func NewSubscriptionMeta ¶
func NewSubscriptionMeta() *SubscriptionMeta
type Topic ¶
type Topic struct {
// contains filtered or unexported fields
}
func (*Topic) BatchPublishMessage ¶
func (*Topic) GetTopicAttributes ¶
func (*Topic) ListSubscription ¶
func (*Topic) PublishMessage ¶
type TopicMeta ¶
type TopicMeta struct {
// 当前该主题的消息堆积数
MsgCount int
// 消息最大长度,取值范围1024-1048576 Byte(即1-1024K),默认1048576
MaxMsgSize int
//消息在主题中最长存活时间,从发送到该主题开始经过此参数指定的时间后,
//不论消息是否被成功推送给用户都将被删除,单位为秒。固定为一天,该属性不能修改。
MsgRetentionSeconds int
//创建时间
CreateTime int
//修改属性信息最近时间
LastModifyTime int
LoggingEnabled int
FilterType int
}
func NewTopicMeta ¶
func NewTopicMeta() *TopicMeta
Click to show internal directories.
Click to hide internal directories.