All Products
Search
Document Center

Simple Message Queue (formerly MNS):Overview

Last Updated:Nov 04, 2024

This topic describes the download sources and sample code of Simple Message Queue (SMQ, formerly MNS) SDK for Python.

Download sources

Select a version based on your business requirements before you download SMQ SDK for Python. SMQ allows you to download SDK packages from PyPI and provides source sample code at GitHub.

Source

Description

PyPI

PyPI provides the source code packages of SMQ SDK for Python that you can download. You can obtain the required version of SMQ SDK for Python from PyPI.

For more information, see aliyun-mns-sdk.

GitHub

GitHub provides the source sample code of SMQ SDK for Python 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-mns-python-sdk.

Note
  • In this example, SMQ SDK for Python 1.2.0 is used. For more information, see Versions.

  • We recommend that you use the latest version of SMQ SDK for Python for debugging.

  • The Account, Queue, Topic, and Subscription structures in the SDK for Python are not thread-safe. You must independently create instances in multi-threading scenarios.

Sample code

SMQ SDK for Python provides a variety of sample code files for your reference or use. The following table describes the sample code files provided by SMQ SDK for Python.

Type

Content

References

Demo download

Queue

Create a queue

Use SMQ SDK for Python to manage messages of a queue

createqueue.py

Delete a queue

Use SMQ SDK for Python to manage messages of a queue

deletequeue.py

Send a message

Use SMQ SDK for Python to manage messages of a queue

sendmessage.py

Receive and consume a message

Use SMQ SDK for Python to manage messages of a queue

recvdelmessage.py

Topic

Create a topic

Use SMQ SDK for Python to send messages to a topic

createtopic.py

Create a subscription whose downstream is a queue

Use SMQ SDK for Python to send messages to a topic

subscribe_queueendpoint.py

Delete a topic

Use SMQ SDK for Python to send messages to a topic

deletetopic.py

Publish a message

Use SMQ SDK for Python to send messages to a topic

publishmessage.py