mirror of
https://github.com/hanzoai/pubsub.git
synced 2026-08-05 01:01:43 +00:00
main
Docker Build & Push (Reusable) / build-arm64 (push) Skipped
Docker Build & Push (Reusable) / build-amd64 (push) Failing after 19s
Docker Build & Push (Reusable) / create-manifest (push) Skipped
Docker Build & Push (Reusable) / sbom (push) Skipped
Docker / docker (push) Failing after 21s
Docker Build & Push (Reusable) / tag-single-arch (push) Skipped
Docker Build & Push (Reusable) / deploy (push) Skipped
Vulnerability Scan / govulncheck (push) Canceled after 0s
The official golang images set GOTOOLCHAIN=local, so a go.mod `go` directive
newer than the base image fails the build at the first go command:
go: go.mod requires go >= 1.26.5 (running go 1.26.4; GOTOOLCHAIN=local)
Two orthogonal changes. Pinning the base to the exact patch go.mod names makes
the build hermetic — the versions match, so no toolchain is downloaded.
GOTOOLCHAIN=auto is the resilience half: when go.mod next moves ahead of the
pin, the toolchain is fetched and checksum-verified against sum.golang.org
instead of failing the build outright.
docker/Dockerfile.nightly keeps its floating golang:alpine base on purpose —
tracking the newest Go is the point of that image, and pinning it would add a
second thing to bump. GOTOOLCHAIN=auto alone makes it correct whatever the tag
resolves to.
Co-authored-by: Hanzo Dev <dev@hanzo.ai>
Hanzo PubSub
High-performance event streaming and message queue for modern distributed systems.
Overview
Hanzo PubSub is a lightweight, high-performance messaging system designed for cloud-native applications. It provides reliable pub/sub messaging, persistent streams, and exactly-once delivery semantics.
Features
- Pub/Sub Messaging - Flexible publish-subscribe patterns with subject-based routing
- Persistent Streams - Durable message storage with configurable retention
- Consumer Groups - Scalable message consumption with automatic load balancing
- Exactly-Once Delivery - Guaranteed message delivery with deduplication
- Key-Value Store - Built-in distributed key-value storage
- Object Store - Store and retrieve large objects efficiently
- Clustering - Horizontal scaling with automatic failover
Quick Start
Docker
docker run -d --name hanzo-pubsub \
-p 4222:4222 \
-p 8222:8222 \
hanzoai/pubsub:latest
Docker Compose
version: '3.8'
services:
pubsub:
image: hanzoai/pubsub:latest
ports:
- "4222:4222" # Client connections
- "8222:8222" # Management/monitoring
volumes:
- pubsub-data:/data
command: ["--jetstream", "--store_dir=/data"]
volumes:
pubsub-data:
SDK Support
- Python:
pip install hanzo-pubsub - Go:
go get github.com/hanzoai/pubsub-go - TypeScript:
npm install @hanzo/pubsub - Rust:
cargo add hanzo-pubsub
Example Usage
Basic Pub/Sub
from hanzo.pubsub import connect
async def main():
# Connect to PubSub
ps = await connect("nats://localhost:4222")
# Subscribe to a subject
async def handler(msg):
print(f"Received: {msg.data}")
await ps.subscribe("events.>", handler)
# Publish messages
await ps.publish("events.user.created", {"user_id": "123"})
Persistent Streams
from hanzo.pubsub import connect, StreamConfig
async def main():
ps = await connect("nats://localhost:4222")
js = ps.jetstream()
# Create a stream
await js.add_stream(StreamConfig(
name="ORDERS",
subjects=["orders.*"],
retention="limits",
max_msgs=1_000_000,
))
# Publish to stream
await js.publish("orders.new", {"order_id": "abc123"})
# Create durable consumer
consumer = await js.pull_subscribe("orders.*", durable="processor")
# Process messages
async for msg in consumer.fetch(batch=10):
await process_order(msg.data)
await msg.ack()
Architecture
┌──────────────────────────────────────────────────┐
│ Cluster │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ │ Node 1 │◀──▶│ Node 2 │◀──▶│ Node 3 │ │
│ └─────────┘ └─────────┘ └─────────┘ │
│ │ │ │ │
│ └──────────────┼──────────────┘ │
│ │ │
│ ┌───────┴───────┐ │
│ │ JetStream │ │
│ │ (Streams) │ │
│ └───────────────┘ │
└──────────────────────────────────────────────────┘
Performance
- Messages/sec: 10M+ messages per second
- Latency: Sub-millisecond publish latency
- Connections: 100K+ concurrent connections per node
Documentation
License
MIT License - see LICENSE for details.
Languages
Go
99.7%
Shell
0.3%