Documentation
¶
Index ¶
- Variables
- type Config
- type Engine
- type PlainRetry
- type PlainRetryHandler
- type Queue
- func (q *Queue) AttachTo(n *notificationqueue.Notifier) error
- func (q *Queue) Detach() error
- func (q *Queue) PopChan() (<-chan *notificationqueue.Execution, error)
- func (q *Queue) Push(n *notification.Notification) error
- func (q *Queue) Remove(nid string) error
- func (q *Queue) Start() error
- func (q *Queue) Stop() error
- type RetryHandler
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultExecuteCount = 10
DefaultExecuteCount default execute count
View Source
var DefaultInterval = time.Minute
DefaultInterval default queue interval
View Source
var DefaultTimeout = time.Minute
DefaultTimeout default push timeout
Functions ¶
This section is empty.
Types ¶
type Config ¶
func (*Config) CreateQueue ¶
type Engine ¶
type Engine interface { //List list queued Execution form start List(start string, count int) ([]*notificationqueue.Execution, string, error) //Insert insert execution to queue. //Do nothing if notifiaction exsits Insert(execution *notificationqueue.Execution) error //Replace exectution in queue with given eid. //Do nothing if eid not match. Replace(eid string, new *notificationqueue.Execution) error //Remove notifcation with given nid form queue. //Do nothing if notificatio not found Remove(nid string) error //Start start store Start() error //Stop stop store Stop() error }
Engine queue Engine interface
type PlainRetry ¶
type PlainRetry []string
PlainRetry plain retry config
func (*PlainRetry) CreateRetryHandler ¶
func (r *PlainRetry) CreateRetryHandler() (*PlainRetryHandler, error)
CreateRetryHandler create retry hanlder
type PlainRetryHandler ¶
PlainRetryHandler plain retry handler
func (*PlainRetryHandler) HandleRetry ¶
func (h *PlainRetryHandler) HandleRetry(e *notificationqueue.Execution) (bool, error)
HandleRetry execution update retry count,start time,retry after time. Return false if retry too many.
type Queue ¶
type Queue struct { Engine Engine Timeout time.Duration Interval time.Duration ExecuteCount int IDGenerator func() (string, error) Recover func() OnExecution func(*notificationqueue.Execution) RetryHandler RetryHandler // contains filtered or unexported fields }
Queue queue struct
func (*Queue) AttachTo ¶
func (q *Queue) AttachTo(n *notificationqueue.Notifier) error
AttachTo attach queue to notifier
func (*Queue) PopChan ¶
func (q *Queue) PopChan() (<-chan *notificationqueue.Execution, error)
PopChan return execution chan
func (*Queue) Push ¶
func (q *Queue) Push(n *notification.Notification) error
Push push notification to queue
type RetryHandler ¶
type RetryHandler interface { //HandleRetry execution update retry count,start time,retry after time. //Return false if retry too many. HandleRetry(*notificationqueue.Execution) (bool, error) }
RetryHandler queue retry handler
Click to show internal directories.
Click to hide internal directories.