This is an automated email from the ASF dual-hosted git repository.
lollipop pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-clients.git
The following commit(s) were added to refs/heads/master by this push:
new ab66ab6b Add example of sending lite_topic in python sdk. (#1170)
ab66ab6b is described below
commit ab66ab6beb4300e5516e477cd89bbdeb8bd2a1b7
Author: zhouli11 <[email protected]>
AuthorDate: Tue Jan 6 17:07:12 2026 +0800
Add example of sending lite_topic in python sdk. (#1170)
---
README-CN.md | 6 ++--
README.md | 6 ++--
python/example/lite_producer_example.py | 51 +++++++++++++++++++++++++++++++++
3 files changed, 57 insertions(+), 6 deletions(-)
diff --git a/README-CN.md b/README-CN.md
index 781a3b62..0431f496 100644
--- a/README-CN.md
+++ b/README-CN.md
@@ -25,9 +25,9 @@
| Producer with transactional messages | ✅ | ✅ | ✅ | ✅
| ✅ | ✅ | ✅ | 🚧 |
| Producer with recalling timed/delay messages | ✅ | ✅ | 🚧 | 🚧
| 🚧 | ✅ | 🚧 | 🚧 |
| Simple consumer | ✅ | ✅ | ✅ | ✅
| ✅ | ✅ | ✅ | 🚧 |
-| Push consumer with concurrent message listener | ✅ | ✅ | ✅ | 🚧
| ✅ | ✅ | 🚧 | 🚧 |
-| Push consumer with FIFO message listener | ✅ | ✅ | ✅ | 🚧
| ✅ | ✅ | 🚧 | 🚧 |
-| Push consumer with FIFO consume accelerator | ✅ | ✅ | 🚧 | 🚧
| 🚧 | ✅ | 🚧 | 🚧 |
+| Push consumer with concurrent message listener | ✅ | ✅ | ✅ | ✅
| ✅ | ✅ | 🚧 | 🚧 |
+| Push consumer with FIFO message listener | ✅ | ✅ | ✅ | ✅
| ✅ | ✅ | 🚧 | 🚧 |
+| Push consumer with FIFO consume accelerator | ✅ | ✅ | 🚧 | ✅
| 🚧 | ✅ | 🚧 | 🚧 |
| Priority Message | ✅ | 🚧 | 🚧 | 🚧
| 🚧 | 🚧 | 🚧 | 🚧 |
## 先决条件和构建
diff --git a/README.md b/README.md
index ed166f46..9eee0e85 100644
--- a/README.md
+++ b/README.md
@@ -25,9 +25,9 @@ Provide cloud-native and robust solutions for Java, C++, C#,
Golang, Rust and al
| Producer with transactional messages | ✅ | ✅ | ✅ | ✅
| ✅ | ✅ | ✅ | 🚧 |
| Producer with recalling timed/delay messages | ✅ | ✅ | 🚧 | 🚧
| 🚧 | ✅ | 🚧 | 🚧 |
| Simple consumer | ✅ | ✅ | ✅ | ✅
| ✅ | ✅ | ✅ | 🚧 |
-| Push consumer with concurrent message listener | ✅ | ✅ | ✅ | 🚧
| ✅ | ✅ | 🚧 | 🚧 |
-| Push consumer with FIFO message listener | ✅ | ✅ | ✅ | 🚧
| ✅ | ✅ | 🚧 | 🚧 |
-| Push consumer with FIFO consume accelerator | ✅ | ✅ | 🚧 | 🚧
| 🚧 | ✅ | 🚧 | 🚧 |
+| Push consumer with concurrent message listener | ✅ | ✅ | ✅ | ✅
| ✅ | ✅ | 🚧 | 🚧 |
+| Push consumer with FIFO message listener | ✅ | ✅ | ✅ | ✅
| ✅ | ✅ | 🚧 | 🚧 |
+| Push consumer with FIFO consume accelerator | ✅ | ✅ | 🚧 | ✅
| 🚧 | ✅ | 🚧 | 🚧 |
| Priority Message | ✅ | 🚧 | 🚧 | 🚧
| 🚧 | 🚧 | 🚧 | 🚧 |
## Prerequisite and Build
diff --git a/python/example/lite_producer_example.py
b/python/example/lite_producer_example.py
new file mode 100644
index 00000000..6782cd51
--- /dev/null
+++ b/python/example/lite_producer_example.py
@@ -0,0 +1,51 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rocketmq import ClientConfiguration, Credentials, Message, Producer
+
+if __name__ == '__main__':
+ endpoints = "foobar.com:8080"
+ credentials = Credentials()
+
+ # if auth enable
+ # credentials = Credentials("ak", "sk")
+ config = ClientConfiguration(endpoints, credentials)
+ # with namespace
+ # config = ClientConfiguration(endpoints, credentials, "namespace")
+ topic = "parent-topic"
+ producer = Producer(config, (topic,))
+
+ try:
+ producer.startup()
+ try:
+ msg = Message()
+ # parent topic for the current message
+ msg.topic = topic
+ msg.body = "hello, rocketmq.".encode('utf-8')
+ for i in range(0, 10):
+ # set lite_topic
+ msg.lite_topic("lite-test-" + str(i))
+ res = producer.send(msg)
+ print(f"{producer} send message success. {res}")
+ producer.shutdown()
+ print(f"{producer} shutdown.")
+ except Exception as e:
+ print(f"{producer} raise exception: {e}")
+ producer.shutdown()
+ print(f"{producer} shutdown.")
+ except Exception as e:
+ print(f"{producer} startup raise exception: {e}")
+ producer.shutdown()
+ print(f"{producer} shutdown.")