Documentation
¶
Overview ¶
This package contains different message broadcast handler implemenentations. Broadcast handler is responsible for consumeing broadcast messages from the outer world and routing them to the application node.
NOTE: There could be multiple broadcast handlers running at the same time.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broadcaster ¶
type Broadcaster interface { Start(done chan (error)) error Shutdown(ctx context.Context) error // Returns true if the broadcaster fan-outs the same event // to all nodes. Such subscriber shouldn't be used with real pub/sub // engines (which are responsible for message distribution) IsFanout() bool }
type HTTPBroadcaster ¶
type HTTPBroadcaster struct {
// contains filtered or unexported fields
}
HTTPBroadcaster represents HTTP broadcaster
func NewHTTPBroadcaster ¶
func NewHTTPBroadcaster(node Handler, config *HTTPConfig) *HTTPBroadcaster
NewHTTPBroadcaster builds a new HTTPSubscriber struct
func (*HTTPBroadcaster) Handler ¶
func (s *HTTPBroadcaster) Handler(w http.ResponseWriter, r *http.Request)
Handler processes HTTP requests
func (HTTPBroadcaster) IsFanout ¶
func (HTTPBroadcaster) IsFanout() bool
func (*HTTPBroadcaster) Shutdown ¶
func (s *HTTPBroadcaster) Shutdown(ctx context.Context) error
Shutdown stops the HTTP server
func (*HTTPBroadcaster) Start ¶
func (s *HTTPBroadcaster) Start(done chan (error)) error
Start creates an HTTP server or attaches a handler to the existing one
type HTTPConfig ¶
type HTTPConfig struct { // Port to listen on Port int // Path for HTTP broadast Path string // Secret token to authorize requests Secret string }
HTTPConfig contains HTTP pubsub adapter configuration
func NewHTTPConfig ¶
func NewHTTPConfig() HTTPConfig
NewHTTPConfig builds a new config for HTTP pub/sub
type LegacyNATSBroadcaster ¶
type LegacyNATSBroadcaster struct {
// contains filtered or unexported fields
}
func NewLegacyNATSBroadcaster ¶
func NewLegacyNATSBroadcaster(node Handler, c *nconfig.NATSConfig) *LegacyNATSBroadcaster
func (LegacyNATSBroadcaster) IsFanout ¶
func (LegacyNATSBroadcaster) IsFanout() bool
func (*LegacyNATSBroadcaster) Shutdown ¶
func (s *LegacyNATSBroadcaster) Shutdown(ctx context.Context) error
func (*LegacyNATSBroadcaster) Start ¶
func (s *LegacyNATSBroadcaster) Start(done chan (error)) error
type LegacyRedisBroadcaster ¶
type LegacyRedisBroadcaster struct {
// contains filtered or unexported fields
}
LegacyRedisBroadcaster contains information about Redis pubsub connection
func NewLegacyRedisBroadcaster ¶
func NewLegacyRedisBroadcaster(node Handler, config *rconfig.RedisConfig) *LegacyRedisBroadcaster
NewLegacyRedisBroadcaster returns new RedisSubscriber struct
func (LegacyRedisBroadcaster) IsFanout ¶
func (LegacyRedisBroadcaster) IsFanout() bool
func (*LegacyRedisBroadcaster) Shutdown ¶
func (s *LegacyRedisBroadcaster) Shutdown(ctx context.Context) error
Shutdown is no-op for Redis
func (*LegacyRedisBroadcaster) Start ¶
func (s *LegacyRedisBroadcaster) Start(done chan (error)) error
Start connects to Redis and subscribes to the pubsub channel if sentinels is set it gets the the master address first
type RedisBroadcaster ¶
type RedisBroadcaster struct {
// contains filtered or unexported fields
}
RedisBroadcaster represents Redis broadcaster using Redis streams
func NewRedisBroadcaster ¶
func NewRedisBroadcaster(node Handler, config *rconfig.RedisConfig) *RedisBroadcaster
NewRedisBroadcaster builds a new RedisSubscriber struct
func (*RedisBroadcaster) IsFanout ¶
func (s *RedisBroadcaster) IsFanout() bool
func (*RedisBroadcaster) Start ¶
func (s *RedisBroadcaster) Start(done chan error) error