An open source MQTT broker (server) supporting MQTT 5.0, 3.1.1 and 3.1, plus C/C++ client libraries and command-line tools.
ThreeDotsLabs/watermill
A Go library for building event-driven applications, with a unified Publisher/Subscriber interface over Kafka, RabbitMQ, NATS, SQL and more.
- Stars
- 9,927
- Forks
- 515
- Open issues
- 86
- Last commit
- 2 months ago
What is it?
Watermill is a Go library for working with message streams. It targets event-driven applications and patterns such as event sourcing, CQRS, sagas, and RPC over messages. Its core abstraction is a handler that receives a message and returns new messages or an error, with middleware deciding what happens next.
The library defines a common Publisher and Subscriber interface, so the same application code can run on several backends. Supported Pub/Subs include Kafka, RabbitMQ (AMQP), NATS JetStream, Redis Streams, Google Cloud Pub/Sub, AWS SNS/SQS, and SQL databases (MySQL and PostgreSQL), plus an in-memory GoChannel for local use. Pub/Sub implementations live in separate repositories under the ThreeDotsLabs organization.
The project is at v1.0.0 and describes its Pub/Sub implementations as tested with shared test suites run under the race detector and in parallel stress mode. It also publishes a benchmark table comparing throughput across backends on a single test setup.
Key features
- 01Common Publisher and Subscriber interfaces across many message brokers
- 02Handler-based model where handlers return new messages or errors
- 03Middleware for composing behavior such as retries and processing flow
- 04Supports Kafka, RabbitMQ, NATS JetStream, Redis Streams, Google Cloud Pub/Sub, AWS SNS/SQS and SQL databases
- 05In-memory GoChannel for local development and testing
Use cases
- Building event-driven services that exchange messages between components
- Implementing event sourcing or CQRS read models in Go
- Coordinating long-running workflows with sagas
- Switching message brokers without rewriting application logic
Quick start
- 1
Install the Watermill library module
go get github.com/ThreeDotsLabs/watermill - 2
Follow the Quickstart guide on the official site to write your first app
Things to know
- It is a Go library, so it only helps if you build applications in Go.
- Each Pub/Sub backend such as Kafka or RabbitMQ lives in a separate module that you must add yourself.
- Benchmark numbers are rough estimates and depend heavily on setup.
Topics
FAQ
- What is watermill?
- A Go library for building event-driven applications, with a unified Publisher/Subscriber interface over Kafka, RabbitMQ, NATS, SQL and more. Watermill is a Go library for working with message streams. It targets event-driven applications and patterns such as event sourcing, CQRS, sagas, and RPC over messages. Its core abstraction is a handler that receives a message and returns new messages or an error, with middleware deciding what happens next.
- Is watermill free to use? What license does it have?
- watermill is open source under the MIT license. Check the license terms before using it in commercial products.
- Is watermill still maintained?
- Updated within 6 months. The last commit to watermill was on Aug 25, 2026.
- What can I use watermill for?
- Building event-driven services that exchange messages between components Implementing event sourcing or CQRS read models in Go Coordinating long-running workflows with sagas Switching message brokers without rewriting application logic
- How do I install watermill?
- Install the Watermill library module: go get github.com/ThreeDotsLabs/watermill Follow the Quickstart guide on the official site to write your first app
- Where can I get watermill?
- The source code and installation instructions are on GitHub: https://github.com/ThreeDotsLabs/watermill
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A local-first desktop client that manages RocketMQ, Kafka, RabbitMQ, Pulsar, Redis Stream, NATS and other message brokers through one interface.
A Kafka API-compatible streaming data platform written in C++ that runs without ZooKeeper or the JVM.
A Kubernetes operator that runs and manages Apache Kafka clusters on Kubernetes and OpenShift, including Kafka Connect and Kafka Streams.
Open-source usage-based, credit-based and hybrid billing infrastructure with real-time metering, cloud or self-hosted.
Distributed task queue for Python that runs background jobs and schedules work across workers and message brokers.