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 Started
import "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 services
100%Test Coverage
A+Go Report

Why 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.

FeatureDescriptionLink
Publishing PatternsForward capitan events to any broker with middleware transformation, metadata injection, and pluggable codecs.Publishing
Subscribing PatternsConsume broker messages as capitan events with automatic deserialization, acknowledgment, and error handling.Subscribing
Reliability MiddlewareComposable pipz processors for retry with backoff, circuit breaking, timeouts, and rate limiting.Reliability
Custom CodecsPluggable serialization beyond JSON default. Protocol Buffers, Avro, or any custom format via one interface.Codecs
Metadata PropagationHeaders and attributes flow through the entire pipeline and map to broker-native formats. End-to-end tracing support.Concepts
Error HandlingErrors flow through capitan with operation type, signal name, underlying error, and raw payload context.Errors

Articles

Browse the full herald documentation.

OverviewBidirectional bindings between capitan events and message brokers

Learn

QuickstartGet started with herald in minutes
Core ConceptsPublishers, subscribers, providers, and pipelines in herald
ArchitectureInternal design, pipelines, and data flow in herald

Guides

ReliabilityPipeline options for resilient message bridging
CodecsCustom serialization formats
Error HandlingHandling errors in herald
TestingTesting herald-based applications
Publishing GuideForward capitan events to message brokers
Subscribing GuideConsume broker messages as capitan events

Reference

API ReferenceComplete herald API documentation
Providers ReferenceComplete provider configuration reference