You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-5Lines changed: 20 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,7 @@ The current implementation uses [Watermill](https://github.com/ThreeDotsLabs/wat
13
13
-**Flexible Configuration**: YAML configuration files with environment variable overrides via Viper
14
14
-**Worker Pools**: Configurable parallel message processing for subscribers
15
15
-**Subscription Management**: Flexible subscription IDs for load balancing (shared subscriptions) or fanout (separate subscriptions)
16
+
-**Health Checks**: Built-in `Health()` method on `Publisher` for readiness probes (per [HyperFleet Health Endpoints standard](https://github.com/openshift-hyperfleet/architecture/blob/main/hyperfleet/standards/health-endpoints.md))
16
17
-**Simple API**: Clean, easy-to-use interface that hides Watermill complexity
Note for Google PubSub: The Google Pub/Sub publisher implementation (via Watermill/Google Cloud SDK) starts background goroutines (for batching, connection management, etc.).
117
-
The app should call Close() to not leak
117
+
Note for Google Pub/Sub: The Google Pub/Sub publisher implementation (via Watermill/Google Cloud SDK) starts background goroutines (for batching, connection management, etc.).
118
+
The app should call `Close()` to avoid leaking these background goroutines and resources.
118
119
120
+
### Health Check
121
+
122
+
The `Publisher` interface exposes a `Health(ctx context.Context) error` method that consumers can use to verify broker connectivity, typically in `/readyz` endpoints:
123
+
124
+
```go
125
+
iferr:= publisher.Health(ctx); err != nil {
126
+
// Broker is unhealthy — return 503
127
+
log.Printf("Broker health check failed: %v", err)
128
+
}
129
+
```
130
+
131
+
The health check implementation varies by broker:
132
+
-**RabbitMQ**: Checks if the AMQP connection is open and not closed (in-memory, no network call)
133
+
-**Google Pub/Sub**: Performs a lightweight `GetTopic` API call (3s timeout) on a non-existent probe topic to verify connectivity. A `NotFound` response confirms the round-trip succeeded. Requires the `pubsub.topics.get` permission, which is **not** included in `roles/pubsub.publisher`. You must grant an additional role such as `roles/pubsub.viewer`, `roles/pubsub.editor`, or a custom role containing `pubsub.topics.get`.
0 commit comments