Documentation ¶
Index ¶
- Variables
- type DefaultAPI
- type Dispatcher
- type DispatcherConfig
- type GoChannelConfig
- type Handler
- type HandlerRoute
- type MultiBMW
- type MultiHandlerRoutes
- type Parser
- type Publisher
- type Pusher
- type PusherWaiter
- type RetryJob
- type RouteConfig
- type Serializer
- type ServiceInfo
- type SingleRoute
- type Waiter
- type Worker
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MaxRetry = uint8(3) RetryError = errors.New("need retry") )
Functions ¶
This section is empty.
Types ¶
type DefaultAPI ¶
type DefaultAPI struct {
// contains filtered or unexported fields
}
DefaultAPI receives payload only from request body then push it into queue
func NewDefaultAPI ¶
func NewDefaultAPI(host string, routes []*RouteConfig) *DefaultAPI
func (*DefaultAPI) GetEngine ¶
func (api *DefaultAPI) GetEngine() *gin.Engine
GetEngine returns the gin.Engine, so extra path handler can be added
func (*DefaultAPI) StartServe ¶
func (api *DefaultAPI) StartServe() error
type Dispatcher ¶
type Dispatcher struct { // A pool of workers channels that are registered with the dispatcher WorkerPool chan chan RetryJob Config *DispatcherConfig // contains filtered or unexported fields }
Dispatcher manages the workers
func NewDispatcher ¶
func NewDispatcher(handler Handler, waiter Waiter, config *DispatcherConfig) *Dispatcher
NewDispatcher makes a dispatcher
type DispatcherConfig ¶
type GoChannelConfig ¶
type GoChannelConfig struct { }
type HandlerRoute ¶
type HandlerRoute struct { Host string // for api Path string // for api Topic string // for queue (pusher, waiter) Handler Handler }
HandlerRoute is likely deprecated
type MultiBMW ¶
type MultiBMW struct {
// contains filtered or unexported fields
}
func NewMultiBMW ¶
func NewMultiBMW(qConfig interface{}, routes *MultiHandlerRoutes) *MultiBMW
func NewSingleBMW ¶
func NewSingleBMW(qConfig interface{}, route *HandlerRoute) *MultiBMW
type MultiHandlerRoutes ¶
type MultiHandlerRoutes struct { Host string Routes []SingleRoute }
type PusherWaiter ¶
PusherWaiter is both pusher and waiter
type RetryJob ¶
type RetryJob struct { ID string `json:"id"` Retry uint8 `json:"retry"` Payload []byte `json:"payload"` }
RetryJob represents a job pushed into queue
type RouteConfig ¶
type RouteConfig struct {
// contains filtered or unexported fields
}
type Serializer ¶
Serializer serialize the job, therefore which can be pushed into queue
type ServiceInfo ¶
type ServiceInfo struct { ServiceName string `json:"serviceName"` Host string `json:"host"` Privilege int `json:"privilege"` Key string `json:"key"` }
ServiceInfo represents the infomation that Publisher will store at the Registry
type SingleRoute ¶
type Worker ¶
type Worker struct { ID string WorkerPool chan chan RetryJob JobChannel chan RetryJob // contains filtered or unexported fields }
Worker represents the worker that executes the job
Source Files ¶
Click to show internal directories.
Click to hide internal directories.