CMQ currently allows SDK calls based on the TCP protocol for sending and receiving general messages, transaction messages, delayed messages, and async messages. Among them, transaction messages can only be implemented through TCP.
The TCP protocol currently supports public network access and private network access from a CVM instance in a VPC in the same region as the CMQ instance, but does not support the private network access over the classic network.
This document describes how to use the SDK for TCP and install, download, configure, and run the demo to help you quickly build CMQ test projects.
cmq-java-tcp-sdk-master
folder then.SecretID
, and SecretKey
.demo
folder.producer.setNameServerAddress("Corresponding NameServer");
producer.setSecretID("Obtained SecretID")
producer.setSecretKey("Obtained SecretKey")
String queue = "Name of the created queue"
The details are as follows:ProducerDemo
file is successfully executed, the log will be displayed as follows:ConsumerDemo
file to receive messages.PublishDemo
class to send messages with the topic model.SubscriberDemo
class to receive messages with the topic model.ProducerTransactionDemo
class to send transaction messages.SubscriberTransactionDemo
class to receive transaction messages.Region | Public Network Address | VPC Address |
---|---|---|
India | http://cmq-nameserver-in.tencentcloudapi.com | http://cmq-nameserver-vpc-in.api.tencentyun.com |
Beijing | http://cmq-nameserver-bj.tencentcloudapi.com | http://cmq-nameserver-vpc-bj.api.tencentyun.com |
Shanghai | http://cmq-nameserver-sh.tencentcloudapi.com | http://cmq-nameserver-vpc-sh.api.tencentyun.com |
Guangzhou | http://cmq-nameserver-gz.tencentcloudapi.com | http://cmq-nameserver-vpc-gz.api.tencentyun.com |
North America | http://cmq-nameserver-ca.tencentcloudapi.com | http://cmq-nameserver-vpc-ca.api.tencentyun.com |
Chengdu | http://cmq-nameserver-cd.tencentcloudapi.com | http://cmq-nameserver-vpc-cd.api.tencentyun.com |
Chongqing | http://cmq-nameserver-cq.tencentcloudapi.com | http://cmq-nameserver-vpc-cq.api.tencentyun.com |
Hong Kong (China) | http://cmq-nameserver-hk.tencentcloudapi.com | http://cmq-nameserver-vpc-hk.api.tencentyun.com |
Korea | http://cmq-nameserver-kr.tencentcloudapi.com | http://cmq-nameserver-vpc-kr.api.tencentyun.com |
Russia | http://cmq-nameserver-ru.tencentcloudapi.com | http://cmq-nameserver-vpc-ru.api.tencentyun.com |
Singapore | http://cmq-nameserver-sg.tencentcloudapi.com | http://cmq-nameserver-vpc-sg.api.tencentyun.com |
Thailand | http://cmq-nameserver-th.tencentcloudapi.com | http://cmq-nameserver-vpc-th.api.tencentyun.com |
East US | http://cmq-nameserver-use.tencentcloudapi.com | http://cmq-nameserver-vpc-use.api.tencentyun.com |
West US | http://cmq-nameserver-usw.tencentcloudapi.com | http://cmq-nameserver-vpc-usw.api.tencentyun.com |
Was this page helpful?