-
Notifications
You must be signed in to change notification settings - Fork 491
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Feature request
Please add support for gRPC Pub/Sub in Watermill.
Description
Currently, Watermill's Pub/Sub component does not support the gRPC protocol. Integrating gRPC Pub/Sub would allow Watermill to act as a message broker using efficient gRPC communication, enabling publish/subscribe scenarios in distributed microservices.
Example use case
In distributed microservices, developers want to use Watermill's Pub/Sub API to transmit events across services via gRPC. This would let services written in different languages (as long as they support gRPC) seamlessly publish and consume messages.
How it can look like in code
// Suppose Watermill provides a gRPC PubSub implementation:
pubSub, err := grpcpubsub.New(config)
if err != nil {
log.Fatal(err)
}
message := message.NewMessage(watermill.NewUUID(), []byte("Hello via gRPC"))
if err := pubSub.Publish("events", message); err != nil {
log.Fatal(err)
}
// Subscription
go func() {
messages, err := pubSub.Subscribe(context.Background(), "events")
if err != nil {
log.Fatal(err)
}
for msg := range messages {
fmt.Printf("Received message: %s\n", string(msg.Payload))
}
}()Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request