Documentation
¶
Index ¶
- type Message
- type PubSub
- type PublishedMessage
- type Subscriber
- func (s *Subscriber) AddSubscription(topics ...string) uint64
- func (s *Subscriber) Consumable() bool
- func (s *Subscriber) Destroy()
- func (s *Subscriber) Listener() chan struct{}
- func (s *Subscriber) Next() *PublishedMessage
- func (s *Subscriber) Unsubscribe(topics ...string) uint64
- func (s *Subscriber) UnsubscribeAll() uint64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PubSub ¶
type PubSub struct {
// contains filtered or unexported fields
}
PubSub - Pub/Sub Server i.e. holds which clients are subscribed to what topics, manages publishing messages to correct topics, handles (un-)subscription requests
In other words state manager of Pub/Sub Broker
type PublishedMessage ¶
PublishedMessage - Subscriber will receive message for consumption in this form
type Subscriber ¶
type Subscriber struct {
// contains filtered or unexported fields
}
Subscriber - Uniquely identifiable subscriber with multiple subscribed topics from where it wishes to listen from over ping channel
func (*Subscriber) AddSubscription ¶
func (s *Subscriber) AddSubscription(topics ...string) uint64
AddSubscription - Add subscriptions to more topics on-the-fly
func (*Subscriber) Consumable ¶ added in v0.1.6
func (s *Subscriber) Consumable() bool
Consumable - Checks whether any consumable messages in buffer or not [ concurrent-safe ]
func (*Subscriber) Destroy ¶ added in v0.1.6
func (s *Subscriber) Destroy()
Destroy - Asks hub to remove communication channel to this subscriber
func (*Subscriber) Listener ¶ added in v0.1.6
func (s *Subscriber) Listener() chan struct{}
Listener - Get notified when new message is received
func (*Subscriber) Next ¶
func (s *Subscriber) Next() *PublishedMessage
Next - Attempt to consume oldest message living in buffer, by popping it out, in concurrent-safe manner
If nothing exists, it'll return nil
func (*Subscriber) Unsubscribe ¶
func (s *Subscriber) Unsubscribe(topics ...string) uint64
Unsubscribe - Unsubscribe from specified subscribed topics
func (*Subscriber) UnsubscribeAll ¶
func (s *Subscriber) UnsubscribeAll() uint64
UnsubscribeAll - Unsubscribe from all active subscribed topics