cmq

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2018 License: MIT Imports: 11 Imported by: 0

README

腾讯CMQ Golang版本SDK

单独使用
opt := &cmq.Options{
    Credential: &cmq.Credential{

    }
}

client := cmq.NewClient(
    cmq.Region("bj"),
    cmq.NetEnv("wan"),
    cmq.SetCredential(&cmq.Credential{
        SecretId:  "",
        SecretKey: "",
    })

input := models.NewSendMessageReq("queue name", ""msg body")
output := models.NewSendMessageResp()
err := client.Send(input, output)
if err != nil {
  log.Error(err)
}

fmt.Println(output)
配合machinery使用

baocaixiong/machinery

Documentation

Index

Constants

View Source
const (
	Topic = iota
	Queue
)
View Source
const (
	SHA256 = "HmacSHA256"
	SHA1   = "HmacSHA1"
)

Variables

View Source
var (
	WideNetQueueUrl     = "https://cmq-queue-{region}.api.qcloud.com"
	WideNetTopicUrl     = "https://cmq-topic-{region}.api.qcloud.com"
	InternalNetQueueUrl = "http://cmq-queue-{region}.api.tencentyun.com"
	InternalNetTopicUrl = "http://cmq-topic-{region}.api.tencentyun.com"
)
View Source
var UriSec = "/v2/index.php"

Functions

func Float64Ptr

func Float64Ptr(v float64) *float64

func Int64Ptr

func Int64Ptr(v int64) *int64

func IntPtr

func IntPtr(v int) *int

func SliceStringPtr

func SliceStringPtr(v []string) *[]string

func SliceStringValue

func SliceStringValue(v *[]string) []string

func StringPtr

func StringPtr(v string) *string

func Uint64Ptr

func Uint64Ptr(v uint64) *uint64

func UintPtr

func UintPtr(v uint) *uint

Types

type Client

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

func NewClient

func NewClient(opts ...Option) *Client

func (*Client) Init

func (c *Client) Init(opts ...Option)

func (*Client) Send

func (c *Client) Send(ctx context.Context, request models.IRequest, response models.IResponse) (err error)

type Credential

type Credential struct {
	SecretId  string `yaml:"secret_id"`
	SecretKey string `yaml:"secret_key"`
}

type Option

type Option func(*Options)

func NetEnv

func NetEnv(e string) Option

func Region

func Region(r string) Option

func SetCredential

func SetCredential(c *Credential) Option

func Transaction

func Transaction(t *http.Transport) Option

type Options

type Options struct {
	Region     string      `yaml:"region"`
	Credential *Credential `yaml:"credential"`
	NetEnv     string      `yaml:"net_env"`
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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