Documentation ¶
Overview ¶
Package broker implements types used for routing inputs to outputs in non-trivial arrangements, such as fan-out or fan-in models.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FanIn ¶
type FanIn struct {
// contains filtered or unexported fields
}
FanIn is a broker that implements types.Producer, takes an array of inputs and routes them through a single message channel.
func (*FanIn) CloseAsync ¶
func (i *FanIn) CloseAsync()
CloseAsync shuts down the FanIn broker and stops processing requests.
func (*FanIn) MessageChan ¶
MessageChan returns the channel used for consuming messages from this broker.
func (*FanIn) StartListening ¶
StartListening assigns a new responses channel for the broker to read.
type FanOut ¶
type FanOut struct {
// contains filtered or unexported fields
}
FanOut is a broker that implements types.Consumer and broadcasts each message out to an array of outputs.
func NewFanOut ¶
func NewFanOut( conf FanOutConfig, outputs []types.Consumer, logger log.Modular, stats metrics.Type, ) (*FanOut, error)
NewFanOut creates a new FanOut type by providing outputs.
func (*FanOut) CloseAsync ¶
func (o *FanOut) CloseAsync()
CloseAsync shuts down the FanOut broker and stops processing requests.
func (*FanOut) ResponseChan ¶
ResponseChan returns the response channel.
func (*FanOut) StartReceiving ¶
StartReceiving assigns a new messages channel for the broker to read.
type FanOutConfig ¶
type FanOutConfig struct { }
FanOutConfig is config values for the fan out type.
func NewFanOutConfig ¶
func NewFanOutConfig() FanOutConfig
NewFanOutConfig creates a FanOutConfig fully populated with default values.
type RoundRobin ¶
type RoundRobin struct {
// contains filtered or unexported fields
}
RoundRobin is a broker that implements types.Consumer and sends each message out to a single consumer chosen from an array in round-robin fashion. Consumers that apply backpressure will block all consumers.
func NewRoundRobin ¶
NewRoundRobin creates a new RoundRobin type by providing consumers.
func (*RoundRobin) CloseAsync ¶
func (o *RoundRobin) CloseAsync()
CloseAsync shuts down the RoundRobin broker and stops processing requests.
func (*RoundRobin) ResponseChan ¶
func (o *RoundRobin) ResponseChan() <-chan types.Response
ResponseChan returns the response channel.
func (*RoundRobin) StartReceiving ¶
func (o *RoundRobin) StartReceiving(msgs <-chan types.Message) error
StartReceiving assigns a new messages channel for the broker to read.
func (*RoundRobin) WaitForClose ¶
func (o *RoundRobin) WaitForClose(timeout time.Duration) error
WaitForClose blocks until the RoundRobin broker has closed down.