Generic message bus transport — Unix Socket message routing, session management, heartbeat
Project description
hermes-bus
A generic message bus for Unix Socket IPC — message routing, session management, heartbeat.
Transport-only. Notification logic is injected via configurable hooks — the bus itself knows nothing about audio, display, or LLM context.
Install
pip install hermes-bus
Or from source:
git clone https://github.com/mlinquan/hermes-bus.git
cd hermes-bus && pip install -e .
CLI
# Daemon management
hermes-busd start # Start the bus daemon
hermes-busd stop # Stop the daemon
hermes-busd status # Check daemon + connected endpoints
hermes-busd restart # Restart the daemon
# Foreground server (for debugging)
hermes-bus-server
Python API
from hermes_bus.client import BusClient, send_message
# Long-lived: register as an endpoint and receive messages
client = BusClient("my-service")
client.connect()
for msg in client.poll():
print(msg)
# Short-lived: fire-and-forget
send_message("target-service", {"text": "hello", "type": "ack"})
Architecture
client.py ──── Unix Socket ──── server.py
(BusClient) (BusServer)
- Register endpoint - Session management
- Heartbeat (60s) - Message routing
- Auto-reconnect - Hook triggers
- Thread-safe message queue
busd.py — Daemon manager: start / stop / status / restart
Protocol
4-byte big-endian length prefix + JSON body. Max payload: 10 MB.
Long-lived connections register an endpoint name and can send/receive. Short-lived connections send one message and disconnect — no registration, no endpoint_map pollution.
Hooks
After each message is routed, hook scripts are triggered asynchronously. Resolution priority:
HERMES_BUS_HOOKSenv var (comma-separated or JSON array of script paths)hooks.yamlconfig file- Default: auto-discover
hermes-notify/bus_callback.py
Each hook receives the full message JSON on stdin. Hook execution is non-blocking — the bus continues routing.
Messages
{
"type": "message",
"to": "target-endpoint",
"from": "sender-endpoint",
"text": "hello",
"body": { }
}
Special message types: register (endpoint registration), ping/pong (heartbeat), list_endpoints (admin query).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hermes_bus-0.2.0.tar.gz.
File metadata
- Download URL: hermes_bus-0.2.0.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
435c80445dbb7b69ea5c11ad24d8da6124fe3f6b9519188715abcd3d682d5736
|
|
| MD5 |
25c4d20d6e24b1f48e42a91e4ce144bb
|
|
| BLAKE2b-256 |
d4e1dc1f40333dbab660c381ecb193d76e8abbe8adc5d20969d5a581bd5e4dff
|
File details
Details for the file hermes_bus-0.2.0-py3-none-any.whl.
File metadata
- Download URL: hermes_bus-0.2.0-py3-none-any.whl
- Upload date:
- Size: 16.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
918899d131f0efec8211362116f8adcb05dd8d0c03c4973533027abaa06c3c48
|
|
| MD5 |
d6cfeef759dedd8275fc78d07a00f71e
|
|
| BLAKE2b-256 |
f86dfce69115e41930e7e4e81f51712d664f25c5dfb5f71ca0b1a9920e99516e
|