Bidirectional Event Bridge for Go. Internal Events Meet External Messages.
Connect capitan events to distributed message brokers. Publish internal events to Kafka, NATS, or SQS — subscribe from brokers and emit as capitan events. Same types, same signals, both directions.
Get Startedimport "github.com/zoobz-io/herald"
// Publish internal events to a broker
publisher := herald.NewPublisher[Order](cap, provider,
herald.WithSignal(orderCreatedSignal),
herald.UseApply(addTraceHeaders),
)
publisher.Start(ctx) // Events flow out automatically
// Subscribe from broker, emit as capitan events
subscriber := herald.NewSubscriber[Order](cap, provider,
herald.WithKey(orderKey),
herald.UseApply(herald.Retry(3, herald.ExponentialBackoff(time.Second))),
)
subscriber.Start(ctx) // Messages flow in as events
// Same types, same signals — zero coupling between servicesWhy Herald?
One abstraction for event publishing and subscribing across any message broker.
Bidirectional Flow
Publishers forward capitan events to brokers. Subscribers pull messages and emit as capitan events. Same contract both ways.
11 Broker Providers
Kafka, NATS, JetStream, Pub/Sub, Redis, SQS, AMQP, SNS, BoltDB, Firestore, io. Switch brokers without changing application code.
Pipeline Reliability
Retry, backoff, timeout, circuit breaker, and rate limiting via pipz middleware. Per-operation pipeline configuration.
Automatic Acknowledgment
Ack on success, Nack on failure. Each broker maps to native semantics — Kafka offsets, JetStream Ack, SQS delete.
Type-Safe Generics
Compile-time checked publishers and subscribers via capitan keys. No runtime type assertions or interface{} juggling.
Error Observability
All errors emit as capitan events via herald.ErrorSignal. Centralized handling using existing observability infrastructure.
Capabilities
Publish and subscribe across message brokers with type safety, reliability, and observability.
| Feature | Description | Link |
|---|---|---|
| Publishing Patterns | Forward capitan events to any broker with middleware transformation, metadata injection, and pluggable codecs. | Publishing |
| Subscribing Patterns | Consume broker messages as capitan events with automatic deserialization, acknowledgment, and error handling. | Subscribing |
| Reliability Middleware | Composable pipz processors for retry with backoff, circuit breaking, timeouts, and rate limiting. | Reliability |
| Custom Codecs | Pluggable serialization beyond JSON default. Protocol Buffers, Avro, or any custom format via one interface. | Codecs |
| Metadata Propagation | Headers and attributes flow through the entire pipeline and map to broker-native formats. End-to-end tracing support. | Concepts |
| Error Handling | Errors flow through capitan with operation type, signal name, underlying error, and raw payload context. | Errors |
Articles
Browse the full herald documentation.