Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broker ¶
type Broker[T any] struct { // contains filtered or unexported fields }
Broker manages the publisher/subscriber pattern in a thread-safe, generic way.
func NewBrokerWithOptions ¶
NewBrokerWithOptions creates a new Broker with custom buffer size.
func (*Broker[T]) GetSubscriberCount ¶
GetSubscriberCount returns the current number of active subscribers.
func (*Broker[T]) Publish ¶
Publish broadcasts an event to all subscribers. It is non-blocking: if a subscriber is slow/full, they miss the message.
func (*Broker[T]) Shutdown ¶
func (b *Broker[T]) Shutdown()
Shutdown closes the broker and all subscriber channels.
Click to show internal directories.
Click to hide internal directories.