Skip to main content

smart_messaging_core

可擴充的通訊核心套件,提供統一的 MessagingClient facade,並可依 route 將訊息導向不同協議。

PyPI 發佈狀態

安裝:

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 / subscribe
  • http: publish / subscribe(webhook)
  • kafka: publish / subscribe
  • redis: 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.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smart-messaging-core 0.1.3
File Size Uploaded Provenance Actions
smart_messaging_core-0.1.3.tar.gz 14.3 kB Without provenance Details for smart_messaging_core-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for smart-messaging-core 0.1.3
File Interpreter ABI Platform Actions
smart_messaging_core-0.1.3-py3-none-any.whl Python 3 none any Details for smart_messaging_core-0.1.3-py3-none-any.whl

Total release size: 27.0 kB

Release files / smart_messaging_core-0.1.3.tar.gz

Download URL smart_messaging_core-0.1.3.tar.gz
Size 14.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e7f21c894e8d5d6c11d46952ccb7e02647fcc280571a0b9366aceca59b60dd67
BLAKE2b-256 checksum
How to use checksums
c66a40d0b5b552adbee6eb9641576b0cc4a5b7fcef82fe7821046a2a7cd5ebd3
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.3-py3-none-any.whl

Download URL smart_messaging_core-0.1.3-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1eb1eebb7a65e5465051ff5d7847cb000c82d43252849fee890705474087c4f0
BLAKE2b-256 checksum
How to use checksums
50282ef599ef1a08481c08a07618c74b639dff13c3d6b846675ecf6c80d1629c
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.3

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page