Watermill
A production-ready Watermill pub/sub plugin for KubeMQ — Publisher/Subscriber across Events, EventsStore, and Queues, plus a native CQPublisher.
kubemq-watermill is a production-ready
Watermill pub/sub plugin for KubeMQ. It implements Watermill's
message.Publisher and message.Subscriber interfaces across three KubeMQ messaging
patterns — Events, EventsStore, and Queues — plus a native CQPublisher for Commands and
Queries (request-reply). Drop it into an existing Watermill application and your Router,
handlers, and middleware run unchanged on top of KubeMQ.
It is a native gRPC client built on the kubemq-go/v2 SDK — not an HTTP connector.
If you need protocol bridging instead (REST, MCP, A2A, CloudEvents), see the
Connectors overview. For the messaging model behind the patterns,
see the core docs: Events, Events Store,
Queues, and RPC.
Why Watermill on KubeMQ
- Three messaging patterns — Events (fire-and-forget), EventsStore (persistent with
replay), and Queues (reliable with explicit ack/nack), each behind the same Watermill
Publisher/Subscriberinterfaces. - Native CQPublisher — wraps KubeMQ's Commands and Queries APIs directly for low-latency request-reply, with execution confirmation and query caching.
- Full Watermill compatibility — works with the Watermill Router and the entire standard middleware stack (Retry, Throttle, CorrelationID, Poison Queue, CircuitBreaker).
- Ack/Nack bridged to KubeMQ — Watermill
msg.Ack()/msg.Nack()map to KubeMQ queue settlement; a Nack returns the message to the queue for redelivery. - Built-in DLQ, OTel, and metrics — native dead-lettering via
QueueMessagePolicy, W3C Trace Context propagation through KubeMQ Tags, and Watermill's Prometheus component. - Verified compatibility — passes the full Watermill
pubsub/tests.TestPubSubsuite.
Architecture
Your Watermill Router, Publisher, and Subscriber call the plugin, which uses
kubemq-go/v2 to open a gRPC connection to the KubeMQ broker on port 50000. There is no
HTTP connector and no server-side translation layer — the broker's gRPC server is always
on, so the plugin works as soon as a broker is reachable.
The plugin maps Watermill's Publisher/Subscriber model onto KubeMQ patterns over the native gRPC SDK on port 50000.
Capabilities
Each Publisher and Subscriber serves exactly one KubeMQ pattern, selected with the
Pattern field. Commands and Queries use the standalone CQPublisher.
Events
Fire-and-forget pub/sub with PatternEvents — fan-out, consumer groups, and streaming publish.
Events Store
Persistent, replayable events with PatternEventsStore — start from first, last, a sequence, or a point in time.
Queues
Reliable point-to-point delivery with explicit ack/nack, batching, and native DLQ routing.
Commands & Queries
Native CQPublisher for low-latency request-reply over KubeMQ Commands and Queries.
Pattern selection
KubeMQ supports three messaging patterns. Each Publisher/Subscriber instance serves exactly one — pick the one that matches your delivery and persistence needs:
| Pattern | Delivery | Ack/Nack | Persistence | Best for |
|---|---|---|---|---|
| Events | At-most-once | No (fire-and-forget) | No | Real-time notifications, metrics, logs |
| EventsStore | At-least-once | Offset auto-advance | Yes (replay from any point) | Event sourcing, audit trails, stream replay |
| Queues | At-least-once | Explicit ack/nack | Yes (until acked) | Task queues, job processing, reliable delivery |
For request-reply, reach for the native CQPublisher (single hop, lower latency) or
Watermill's requestreply component over Queues (middleware-compatible) — see
Commands & Queries.
Supported runtime
| Requirement | Version |
|---|---|
| Go | 1.25+ |
github.com/ThreeDotsLabs/watermill | v1.5.1 |
github.com/kubemq-io/kubemq-go/v2 | v2.0.3 |
| KubeMQ broker | gRPC on :50000 (always on — no enable flag) |
Install the plugin with go get:
go get github.com/kubemq-io/watermill-kubemqNext steps
Getting Started
Run a broker and publish your first Watermill message over KubeMQ in a few minutes.
Concepts
How the plugin maps Publishers, Subscribers, and the Router onto KubeMQ's patterns, marshaling, and ack semantics.
Guides
Connection and TLS configuration, middleware, OpenTelemetry, Prometheus, and KEDA autoscaling.
Reference
Full PublisherConfig, SubscriberConfig, CQConfig, QueueMessagePolicy, and API reference.
New to KubeMQ? Start with the What is an integration? mental model, then the KubeMQ Getting Started guide.
Was this page helpful?