API Reference

Watermill

A Go library for building event-driven applications with pub/sub, sagas, and multiple brokers.

Official Documentation ↗
CompatibilityThis documentation covers version v1.3. Check the official docs for the latest API surface.

Installation

gogo get github.com/ThreeDotsLabs/watermill

Methods

Watermill models messages, publishers, and subscribers, and routes them through middleware.

Key Features

  • Broker-agnostic publisher and subscriber
  • Router with middleware chains
  • Correlation and retry middleware

Usage Notes

Pin a version and check the official docs for the API surface you depend on before upgrading.

FAQ

How do I add retries?
Wrap the handler with middleware.Retry or your own, and the router applies it around every handler consistently.
How does correlation work?
Middleware.Correlation copies the correlation id from incoming messages onto any messages a handler publishes.
Which brokers are supported?
Kafka, RabbitMQ, NATS, Google Cloud Pub/Sub, and an in-memory broker among others, all behind the same interfaces.