mirror of
https://gitee.com/quecpython/helios-service.git
synced 2025-05-19 06:08:22 +08:00
19 lines
327 B
Python
19 lines
327 B
Python
import sys_bus
|
|
|
|
|
|
def sub_cb(topic, msg):
|
|
"""
|
|
订阅函数
|
|
:param topic: 订阅的topic
|
|
:param msg: 来自topic的消息
|
|
:return:
|
|
"""
|
|
print("sub_cb === {}".format(topic, msg))
|
|
|
|
|
|
# 订阅topic
|
|
sys_bus.subscribe("test", sub_cb)
|
|
|
|
# 发布消息到topic中
|
|
sys_bus.publish("test", "this is one sys_bus")
|