Broadcaster distributing to a set of filtered sinks is fairly efficient in practice but still requires O(N) for every message sent. Provide the following interface definition to allow implementation of efficient event dispatch:
func NewDispatcher(selector Selector) *Dispatcher
type Selector interface {
// Select zero or more sinks on which the event should be sent.
Select(event Event) []Sink
}
This will allow events to be dispatched to a large set of listeners without incurring O(N) overhead for all messages.
This can also be used to implement load balancing of messages to support worker queues.
Broadcaster
distributing to a set of filtered sinks is fairly efficient in practice but still requiresO(N)
for every message sent. Provide the following interface definition to allow implementation of efficient event dispatch:This will allow events to be dispatched to a large set of listeners without incurring
O(N)
overhead for all messages.This can also be used to implement load balancing of messages to support worker queues.