This topic describes the version source and sample code of Simple Message Queue (formerly MNS) SDK for Java.
Version source
You need to select a version based on your business requirements before you download SMQ SDK for Java. SMQ allows you to download SDK dependencies from Maven Repository and provides source sample code at GitHub.
Source | Description |
Maven Repository | Maven Repository provides the source code packages of SMQ that you can download. You can obtain a Maven project from Maven Repository and add the required version of SMQ SDK for Java to the Maven project. For more information, see Aliyun SMQ SDK for Java. |
GitHub | GitHub provides the source sample code of SMQ SDK for Java and records tag information about the released versions of SMQ SDK. You can view the source code and sample code that you can use in various scenarios at GitHub. For more information, see Aliyun SMQ Java SDK Release. |
In this example, SMQ SDK for Java 1.1.10 is used. For more information, see Versions.
We recommend that you use the latest version of SMQ SDK for Java for debugging to prevent errors.
Sample code
SMQ SDK for Java provides a variety of sample code for your reference or use. The following table describes the sample code files provided by SMQ SDK for Java.
Scenario | Resource type | Content | References | Demo download |
Basic usage | Request | Configure an access credential by using a Resource Access Management (RAM) role | ||
Queue | Message management | Send messages | ||
Receive and consume messages | ||||
Topic | Message management | Send messages | ||
Subscribe to topics to receive messages on downstream clients | ||||
Subscription example | Use sample code to subscribe to a topic and receive messages by using an HTTPS subscription | |||
Advanced scenario | Oversized message | Send and receive oversized messages | ||
Concurrency | Perform a concurrency test |