Documentation
¶
Index ¶
- Constants
- type Event
- type Group
- type Processor
- func (p *Processor) Accept(job Event)
- func (p *Processor) AddSubscriber(n Subscriber)
- func (p *Processor) Clear()
- func (p *Processor) Handle(ctx context.Context, obj interface{})
- func (p *Processor) Name() string
- func (p *Processor) Notify(job Event)
- func (p *Processor) Remove(n Subscriber)
- func (p *Processor) Subjects(name string) *Subject
- type Service
- type ServiceHealthCheckJob
- type ServiceHealthChecker
- type Subject
- type Subscriber
- type Type
Constants ¶
View Source
const ( ServerCheckerName = "__HealthChecker__" ServerCheckSubject = "__NotifyServerHealthCheck__" )
View Source
const (
DefaultQueueSize = 1000
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
func (*Group) AddSubscriber ¶
func (g *Group) AddSubscriber(subscriber Subscriber) Subscriber
func (*Group) Subscribers ¶
func (g *Group) Subscribers(name string) Subscriber
type Processor ¶
func NewProcessor ¶
func (*Processor) AddSubscriber ¶
func (p *Processor) AddSubscriber(n Subscriber)
func (*Processor) Remove ¶
func (p *Processor) Remove(n Subscriber)
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewNotifyService ¶
func NewNotifyService() *Service
func (*Service) AddSubscriber ¶
func (s *Service) AddSubscriber(n Subscriber) error
func (*Service) RemoveSubscriber ¶
func (s *Service) RemoveSubscriber(n Subscriber)
type ServiceHealthCheckJob ¶
type ServiceHealthCheckJob struct { Event ErrorSubscriber Subscriber }
func NewNotifyServiceHealthCheckJob ¶
func NewNotifyServiceHealthCheckJob(s Subscriber) *ServiceHealthCheckJob
type ServiceHealthChecker ¶
type ServiceHealthChecker struct {
Subscriber
}
Notifier 健康检查
func NewNotifyServiceHealthChecker ¶
func NewNotifyServiceHealthChecker() *ServiceHealthChecker
func (*ServiceHealthChecker) OnMessage ¶
func (s *ServiceHealthChecker) OnMessage(job Event)
type Subject ¶
type Subject struct {
// contains filtered or unexported fields
}
func NewSubject ¶
func (*Subject) GetOrNewGroup ¶
type Subscriber ¶
type Subscriber interface { ID() string Subject() string Group() string Type() Type Service() *Service SetService(*Service) Err() error SetError(err error) Close() OnAccept() // The event bus will callback this function, so it must be non-blocked. OnMessage(Event) }
func NewSubscriber ¶
func NewSubscriber(nType Type, subject, group string) Subscriber
Click to show internal directories.
Click to hide internal directories.