Documentation ¶
Index ¶
- type Dispatcher
- type DispatcherImpl
- func (d *DispatcherImpl) GetRegister() register.Register
- func (d *DispatcherImpl) GetSubscribers() map[string]subscriber.Subscriber
- func (d *DispatcherImpl) GetSubscribersPool() map[string]*goroutinepool.GoroutinePool
- func (d *DispatcherImpl) RegisterInput(i input.Input)
- func (d *DispatcherImpl) RegisterSubscriber(s subscriber.Subscriber)
- func (d *DispatcherImpl) SetRouter(r *Router)
- func (d *DispatcherImpl) Start(ctx context.Context)
- func (d *DispatcherImpl) Stop() error
- type Router
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher interface { RegisterSubscriber(s subscriber.Subscriber) RegisterInput(input.Input) Start(ctx context.Context) // block until stopped Stop() error // block until stopped }
func New ¶
func New(dingtalk interfaces.DingTalkApiClientFactory, messenger pb.NotifyServiceServer, httpi *inputhttp.HttpInput, mon *monitor.MonitorHTTP, wh *webhook.WebHookHTTP, registerHttp *register.RegisterHTTP, org org.Interface) (Dispatcher, error)
type DispatcherImpl ¶
type DispatcherImpl struct {
// contains filtered or unexported fields
}
func NewImpl ¶
func NewImpl() (*DispatcherImpl, error)
func (*DispatcherImpl) GetRegister ¶
func (d *DispatcherImpl) GetRegister() register.Register
func (*DispatcherImpl) GetSubscribers ¶
func (d *DispatcherImpl) GetSubscribers() map[string]subscriber.Subscriber
func (*DispatcherImpl) GetSubscribersPool ¶
func (d *DispatcherImpl) GetSubscribersPool() map[string]*goroutinepool.GoroutinePool
func (*DispatcherImpl) RegisterInput ¶
func (d *DispatcherImpl) RegisterInput(i input.Input)
func (*DispatcherImpl) RegisterSubscriber ¶
func (d *DispatcherImpl) RegisterSubscriber(s subscriber.Subscriber)
func (*DispatcherImpl) SetRouter ¶
func (d *DispatcherImpl) SetRouter(r *Router)
func (*DispatcherImpl) Start ¶
func (d *DispatcherImpl) Start(ctx context.Context)
func (*DispatcherImpl) Stop ¶
func (d *DispatcherImpl) Stop() error
1. 关闭所有输入端 (httpserver, inputs) 2. 等待 pool 里的所有消息发送完 3. 关闭 pool 4. 关闭 register
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
+-------------------------+ | Router | | | | +-------------+ | +-------------+ | | | | | backend |
src ----------+---->| A +-----+------> message |
| | | | | consumer | | +-------------+ | | e.g.dingding| +-------------------------+ +-------------+
A: []filter
[]filter:
+---------------+ +---------------+ +----------------+ +-----------------+ | unifylabels +--> registerlabel +--> webhookfilter +--> lastfilter | | | | | | | | | +---------------+ +---------------+ +----------------+ +-----------------+
func NewRouter ¶
func NewRouter(dispatcher *DispatcherImpl) (*Router, error)
func (*Router) GetFilters ¶
func (*Router) RegisterFilter ¶
Click to show internal directories.
Click to hide internal directories.