Coder Social home page Coder Social logo

cmq-go's Introduction

cmq-go

Tencent CMQ Golang SDK

与腾讯云官方SDK接口保持一致

Getting Started

所有的API中都有test case,这里使用CreateQueue举例。

var secretId = "YourTencentSecretId"
var secretKey = "YourTencentSecretKey"
var endpointQueue = "https://cmq-queue-sh.api.qcloud.com"
var endpointQueueInner = "http://cmq-queue-sh.api.tencentyun.com"

// 创建队列
func Test_CreateQueue(t *testing.T) {
    //创建账户
	account := cmq_go.NewAccount(endpointQueue, secretId, secretKey)
	
	//设置队列metadata
	meta := cmq_go.QueueMeta{}
	meta.PollingWaitSeconds = 10
	meta.VisibilityTimeout = 10
	meta.MaxMsgSize = 1048576
	meta.MsgRetentionSeconds = 345600

    //创建队列queue-test-001
	err := account.CreateQueue("queue-test-001", meta)
	if err != nil {
		t.Errorf("queue-test-001 created failed, %v", err.Error())
		return
	}
	t.Log("queue-test-001 created")

    //创建队列queue-test-002
	err = account.CreateQueue("queue-test-002", meta)
	if err != nil {
		t.Errorf("queue-test-002 created failed, %v", err.Error())
		return
	}
	t.Log("queue-test-002 created")
}

Test Case

测试单个方法
go test -v -test.run Test_CreateQueue

API Status

队列模型

队列相关接口

  • CreateQueue
  • ListQueue
  • GetQueueAttributes
  • SetQueueAttributes
  • DeleteQueue

消息相关接口

  • SendMessage
  • BatchSendMessage
  • ReceiveMessage
  • BatchReceiveMessage
  • DeleteMessage
  • BatchDeleteMessage

主题模型

主题相关接口

  • CreateTopic
  • SetTopicAttributes
  • ListTopic
  • GetTopicAttributes
  • DeleteTopic

消息相关接口

  • PublishMessage
  • BatchPublishMessage

订阅相关接口

  • Subscribe
  • ListSubscriptionByTopic
  • SetSubscriptionAttributes
  • GetSubscriptionAttributes
  • Unsubscribe

cmq-go's People

Contributors

netkiddy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.