This topic describes the Software Development Kits (SDKs) that are provided by ApsaraMQ for Kafka for multiple programming languages.
Introduction
The SDK files include demos, library files, toolchains, and compilation scripts. When you use a Message Queue for Apache Kafka SDK, you do not need to write code to develop the SDK. You can go to the directory in which the SDK is installed, specify the required information in the files of the SDK, and then compile the SDK.
SDKs
SDK | Demo | Supported protocol | Reference | README file |
---|---|---|---|---|
Java SDK | Java SDK Demo |
| Send and receive messages by using an instance endpoint | README.md |
Python SDK | Python SDK Demo |
| Use the SDK for Python to send and subscribe to messages | |
C++ SDK | C++ SDK Demo |
| Use the SDK for C++ to send and subscribe to messages | |
Go SDK | Go SDK Demo |
| Use the SDK for Go to send and subscribe to messages | README.md |
PHP SDK | PHP SDK Demo |
| Use the SDK for PHP to send and subscribe to messages | |
Ruby SDK | Ruby SDK Demo |
| Use the SDK for Ruby to send and subscribe to messages | README.md |
Node.js SDK | Node.js SDK Demo |
| Use the SDK for Node.js to send and subscribe to messages | README.md |
C# SDK | None |
| Use the SDK for C# to send and subscribe to messages | README.md |
Usage notes
Instance endpoints
Select an endpoint on your client. ApsaraMQ for Kafka provides the following endpoints to connect your client to a Message Queue for Apache Kafka instance, and then send and consume messages.
- Default endpoint: Use the default endpoint to connect to a ApsaraMQ for Kafka instance, and then send and consume messages.
- SSL endpoint: Use the SSL endpoint to connect to a ApsaraMQ for Kafka instance, and then send and consume messages based on PLAIN authentication. PLAIN authentication is a simple authentication mechanism that is used to verify usernames and passwords. ApsaraMQ for Kafka provides optimized PLAIN authentication that allows you to dynamically create Simple Authentication and Security Layer (SASL) users for an instance without the need to restart the instance. Important If you deployed an instance and the SSL certificate is a 1,024-bit certificate, you can upgrade the SSL certificate to a 4,096-bit certificate for better security. For more information, see Update the SSL certificate algorithm.
- SASL endpoint: Use the SASL endpoint to connect to a ApsaraMQ for Kafka instance over a virtual private cloud (VPC) and send and consume messages based on PLAIN authentication or SCRAM-SHA-256 authentication. When you use the SASL endpoint, the following authentication mechanisms are available:
- PLAIN: a simple authentication mechanism that is used to verify usernames and passwords. ApsaraMQ for Kafka provides PLAIN authentication that allows you to dynamically create SASL users for an instance without the need to restart the instance.
- SCRAM-SHA-256: a hash-based authentication mechanism that allows you to verify usernames and passwords on clients and brokers. SCRAM-SHA-256 authentication provides better security than PLAIN authentication. SCRAM-SHA-256 authentication also allows you to dynamically create SASL users for a ApsaraMQ for Kafka instance without the need to restart the instance.
For more information, see Comparison among endpoints.
Demos
Obtain the demo file of the SDK that you want to use, specify the required information, and then run the program to send and consume messages. For more information, click the demo link of the SDK and then follow the instructions that are displayed on the page that appears.
References
- Purchase and deploy a ApsaraMQ for Kafka instance based on your network type.ApsaraMQ for Kafka For more information, see Purchase and deploy a VPC-connected instance and Purchase and deploy an Internet- and VPC-connected instance.
- Create the topic and Group that you want to use to send and consume messages. For more information, see Step 3: Create resources.
- Message Queue for Apache Kafka verifies only the identity of the default SASL user of an Internet- and VPC-connected instance, and then authorizes the default SASL user to read and write all topics and all consumer groups in the instance. If you want to perform fine-grained access control, enable the access control list (ACL) feature, create an SASL user, and then grant the SASL user specific permissions on the resources of your ApsaraMQ for Kafka instance based on your business requirements. After you enable the ACL feature, the system revokes the default permissions that are granted to the SASL user. For more information, see Grant permissions to SASL users.