Skip to content

Commit

Permalink
Add EnableFallback configuration option and const for topic
Browse files Browse the repository at this point in the history
  • Loading branch information
annismckenzie committed Jan 7, 2024
1 parent 345dc4f commit 29f58c4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pubsub/gochannel/pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import (
"github.com/ThreeDotsLabs/watermill/message"
)

// NoSubscribersFallbackTopic is the fallback topic messages without any subscribers will be sent to.
// This is used if the `EnableFallback` configuration option is enabled.
const NoSubscribersFallbackTopic = "*"

// Config holds the GoChannel Pub/Sub's configuration options.
type Config struct {
// Output channel buffer size.
Expand All @@ -26,6 +30,10 @@ type Config struct {
// When true, Publish will block until subscriber Ack's the message.
// If there are no subscribers, Publish will not block (also when Persistent is true).
BlockPublishUntilSubscriberAck bool

// When true, messages sent to a topic without any subscribers will be sent to the
// subscribers of the `*` topic.
EnableFallback bool
}

// GoChannel is the simplest Pub/Sub implementation.
Expand Down

0 comments on commit 29f58c4

Please sign in to comment.