Documentation ¶
Index ¶
- Variables
- func AddQueue(q *Queue)
- func Get(name string) job.JobFunc
- func RegisterTask(name string, task job.JobFunc)
- func SetLogger(logger *zap.Logger)
- func StartAllQueues()
- func StopAllQueues()
- func Total() int
- type Queue
- type TasksBroker
- type TasksBrokerSTAN
- func (b *TasksBrokerSTAN) Close()
- func (b *TasksBrokerSTAN) Connect() (err error)
- func (b *TasksBrokerSTAN) Delay(taskName string, args ...interface{}) string
- func (b *TasksBrokerSTAN) Healthy() bool
- func (b *TasksBrokerSTAN) Init(URI string, clientID string, channel string, Monitor bool) (err error)
- func (b *TasksBrokerSTAN) MessageReceived(m *stan.Msg)
- func (b *TasksBrokerSTAN) Subscribe() (err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var DebugTasksCounter map[string]int
View Source
var RegisteredTasks map[string]job.JobFunc
A list of tasks that I can execute A map of { task-name: JobFunc }
Functions ¶
func RegisterTask ¶
Task registration may happen before initialization so do not use logger here.
func StopAllQueues ¶
func StopAllQueues()
Types ¶
type TasksBroker ¶
type TasksBroker interface { // URI, workerID, channelName, Monitor Init(string, string, string, bool) error Connect() error Healthy() bool // Delay sends task to a tasks broker. // Delay(taskName string, args ...interface{}) // Returns job's UUID Delay(string, ...interface{}) string Close() }
var Broker TasksBroker
type TasksBrokerSTAN ¶
type TasksBrokerSTAN struct { URI string ID string Monitor bool STAN stan.Conn // NATS-streaming // contains filtered or unexported fields }
Tasks broker implementation for NATS-streaming
func (*TasksBrokerSTAN) Close ¶
func (b *TasksBrokerSTAN) Close()
func (*TasksBrokerSTAN) Connect ¶
func (b *TasksBrokerSTAN) Connect() (err error)
func (*TasksBrokerSTAN) Delay ¶
func (b *TasksBrokerSTAN) Delay(taskName string, args ...interface{}) string
Delay sends a message to TasksBroker (puts a task to a queue) Returns job's UUID
func (*TasksBrokerSTAN) Healthy ¶
func (b *TasksBrokerSTAN) Healthy() bool
func (*TasksBrokerSTAN) MessageReceived ¶
func (b *TasksBrokerSTAN) MessageReceived(m *stan.Msg)
Message from NATS-streaming received (a new task received)
func (*TasksBrokerSTAN) Subscribe ¶
func (b *TasksBrokerSTAN) Subscribe() (err error)
Click to show internal directories.
Click to hide internal directories.