Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RequireReload ¶
func RequireReload(cmd NotificationCommand) bool
RequireReload checks if a given command requires reload
Types ¶
type Notification ¶
type Notification struct { Command NotificationCommand `json:"command"` Payload string `json:"payload"` Signature string `json:"signature"` }
Notification is a type that encodes a message published to a pub sub channel (shared between implementations)
type NotificationCommand ¶
type NotificationCommand string
NotificationCommand represents a notification command
const ( // NoticeAPIUpdated notifies when an API is updated NoticeAPIUpdated NotificationCommand = "ApiUpdated" // NoticeAPIRemoved notifies when an API is removed NoticeAPIRemoved NotificationCommand = "ApiRemoved" // NoticeAPIAdded notifies when an API is added NoticeAPIAdded NotificationCommand = "ApiAdded" // NoticeOAuthServerUpdated notifies when an OAuth server is updated NoticeOAuthServerUpdated NotificationCommand = "OAuthUpdated" // NoticeOAuthServerRemoved notifies when an OAuth server is removed NoticeOAuthServerRemoved NotificationCommand = "OAuthRemoved" // NoticeOAuthServerAdded notifies when an OAuth server is added NoticeOAuthServerAdded NotificationCommand = "OAuthAdded" // DefaultChannel represents the default channel's name DefaultChannel = "janus.cluster.notifications" )
type NotificationListener ¶
type NotificationListener struct {
// contains filtered or unexported fields
}
NotificationListener listens for
func NewNotificationListener ¶
func NewNotificationListener(subscriber Subscriber) *NotificationListener
NewNotificationListener creates a new instance of NotificationListener
func (*NotificationListener) Start ¶
func (n *NotificationListener) Start(fn func(v Notification))
Start starts listening for signals on the cluster
type Notifier ¶
type Notifier interface {
Notify(notification Notification) bool
}
Notifier holds the basic methods to notify listeners
type PublisherNotifier ¶
type PublisherNotifier struct {
// contains filtered or unexported fields
}
PublisherNotifier will use redis pub/sub channels to send notifications
func NewPublisherNotifier ¶
func NewPublisherNotifier(publisher Publisher, channel string) *PublisherNotifier
NewPublisherNotifier creates a new instance of Notifier
func (*PublisherNotifier) Notify ¶
func (r *PublisherNotifier) Notify(notification Notification) bool
Notify will send a notification to a channel
type Subscriber ¶
type Subscriber interface {
Subscribe(channel string, callback func(Notification)) error
}
Subscriber holds the basic methods to subscribe to a topic