mns

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// 生成params的sign字段
	GenerateSign(str string) string

	// 添加队列
	AddQueue(name string, handler QueueHandler, waitSecond int)

	// 获取队列
	GetQueue(name string) Queue

	// 监听队列
	ListenQueues()

	PublishMessage(topicName string, params Params, filterTag string) (*ali_mns.MessageSendResponse, error)
}

Client mns客户端接口

func NewClient

func NewClient(url, accessKeyId, accessKeySecret string, manager log.Manager) Client

NewClient 实例化

type Params

type Params struct {
	Content          interface{} `json:"content"`
	Tag              string      `json:"tag"`
	TraceId          string      `json:"trace_id"`
	ReferServiceName string      `json:"refer_service_name"`
	Sign             string      `json:"sign"`
}

Params 参数

type Queue

type Queue struct {
	Name string // 队列名称

	WaitSecond int
	// contains filtered or unexported fields
}

Queue 队列

func (*Queue) DeleteMessage

func (q *Queue) DeleteMessage(receiptHandler string) error

DeleteMessage 删除消息

func (*Queue) HasHandler

func (q *Queue) HasHandler() bool

HasHandler 是否有处理方法

func (*Queue) SendMessage

func (q *Queue) SendMessage(message string) (ali_mns.MessageSendResponse, error)

SendMessage 发送消息

type QueueHandler

type QueueHandler func(params Params) error

QueueHandler 队列消息的处理器

type Topic

type Topic struct {
	Name     string
	Instance ali_mns.AliMNSTopic
}

topic

Jump to

Keyboard shortcuts

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