smart_messaging_core
可擴充的通訊核心套件,提供統一的 MessagingClient facade,並可依 route 將訊息導向不同協議。
PyPI 發佈狀態
- 正式 PyPI:
smart-messaging-core==0.1.2 - 套件頁面:https://pypi.org/project/smart-messaging-core/
安裝:
pip install smart-messaging-core==0.1.1
本機開發
git clone https://github.com/allenshie/smart_messaging_core.git
cd smart_messaging_core
python -m venv .venv
source .venv/bin/activate
pip install -e .
目前支援的協議
mqtt: publish / subscribehttp: publish / subscribe(webhook)kafka: publish / subscriberedis: publish / subscribe
推薦使用方式
對外建議統一使用 MessagingClient,由 routes 決定實際協議與目標位置。
from smart_messaging_core import (
HttpConfig,
MessagingClient,
MessagingConfig,
MqttConfig,
RouteConfig,
)
cfg = MessagingConfig(
mqtt=MqttConfig(host="localhost", port=1883, qos=1, retain=True),
http=HttpConfig(base_url="http://localhost:8080"),
routes={
"phase_publish": RouteConfig(backend="http", channel="/phase"),
"edge_events": RouteConfig(backend="mqtt", channel="edge/events"),
},
)
client = MessagingClient(cfg)
client.publish("phase_publish", {"phase": "working_stage_1"})
client.subscribe("edge_events", lambda payload: print(payload))
文件
設計說明
- 對外 API:
MessagingClient - 協議實作集中在
protocols/ - 每個協議提供對應
Config與Client - route-based 設計可讓不同用途走不同 backend/channel
- 錯誤處理可透過
failure_mode控制(degraded只 log;strict會 raise)
Metadata
Release files for smart-messaging-core 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| smart_messaging_core-0.1.2.tar.gz | 13.7 kB | Without provenance | Details for smart_messaging_core-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| smart_messaging_core-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for smart_messaging_core-0.1.2-py3-none-any.whl |
Total release size: 26.1 kB
Release files / smart_messaging_core-0.1.2.tar.gz
| Download URL | smart_messaging_core-0.1.2.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6fa1495ee4c121f2dfec04bda1791a14074bea8668ef39d1583e44a312a4b818
|
|
BLAKE2b-256 checksum How to use checksums |
35db8b60e510e5f7ab2fb9c4ca6add78b3e3c9acddbdd1c157fda8beefb8badf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.11
|
Release files / smart_messaging_core-0.1.2-py3-none-any.whl
| Download URL | smart_messaging_core-0.1.2-py3-none-any.whl |
|---|---|
| Size | 12.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e813b9a934b1c7744b4424b9344bd2471787ae698b28ce82c3d9b4386eeeaf12
|
|
BLAKE2b-256 checksum How to use checksums |
337572ca6b3e7b6f93e66aa36472d999b0256f0151eca754eabce4cd24941355
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.11
|
Security for smart-messaging-core 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.