Documentation ¶
Index ¶
- type EventsStream
- func (b *EventsStream) AddSubscriber() Subscriber
- func (b *EventsStream) Broadcast(msg any, topics []string)
- func (b *EventsStream) Publish(topic string, msg any)
- func (b *EventsStream) RemoveSubscriber(sub Subscriber)
- func (b *EventsStream) Shutdown()
- func (b *EventsStream) Subscribe(sub Subscriber, topic string)
- func (b *EventsStream) SubscribersCount(topic string) int
- func (b *EventsStream) Unsubscribe(sub Subscriber, topic string)
- type Message
- type Subscriber
- type Subscribers
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventsStream ¶
type EventsStream struct {
// contains filtered or unexported fields
}
EventsStream defines the stream broker
func (*EventsStream) AddSubscriber ¶
func (b *EventsStream) AddSubscriber() Subscriber
AddSubscriber adds a subscriber
func (*EventsStream) Broadcast ¶
func (b *EventsStream) Broadcast(msg any, topics []string)
Broadcast notifies all subscribers of a given topic of a new message
func (*EventsStream) Publish ¶
func (b *EventsStream) Publish(topic string, msg any)
Publish publishes a message to a topic
func (*EventsStream) RemoveSubscriber ¶
func (b *EventsStream) RemoveSubscriber(sub Subscriber)
RemoveSubscriber removes a subscriber
func (*EventsStream) Subscribe ¶
func (b *EventsStream) Subscribe(sub Subscriber, topic string)
Subscribe subscribes a subscriber to a topic
func (*EventsStream) SubscribersCount ¶
func (b *EventsStream) SubscribersCount(topic string) int
SubscribersCount returns the number of subscribers for a given topic
func (*EventsStream) Unsubscribe ¶
func (b *EventsStream) Unsubscribe(sub Subscriber, topic string)
Unsubscribe removes a subscriber from a topic
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message defines the stream message
func NewMessage ¶
NewMessage creates an instance of Stream Message
type Subscriber ¶
type Subscriber interface { Topics() []string Iterator() chan *Message Shutdown() Active() bool ID() string // contains filtered or unexported methods }
Subscriber defines the Subscriber Interface
type Subscribers ¶
type Subscribers map[string]Subscriber
Subscribers defines the map of subscribers
Click to show internal directories.
Click to hide internal directories.