worker

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2020 License: MIT Imports: 16 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Listenable

type Listenable struct {
	Listenable astibob.Listenable
	Runnable   string
	Worker     string
}

type Message

type Message struct {
	Name    string
	Payload interface{}
}

type MessageOptions

type MessageOptions struct {
	OnDone   OnDone
	Message  Message
	Runnable string
	Worker   string
}

type OnDone

type OnDone func(success bool) error

type Options

type Options struct {
	Index  astibob.ServerOptions `toml:"index"`
	Server astibob.ServerOptions `toml:"server"`
}

type Runnable

type Runnable struct {
	AutoStart bool
	Runnable  astibob.Runnable
}

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

func New

func New(name string, o Options, l astikit.StdLogger) (w *Worker)

New creates a new worker

func (*Worker) Close

func (w *Worker) Close() error

Close closes the worker properly

func (*Worker) HandleSignals

func (w *Worker) HandleSignals()

HandleSignals handles signals

func (*Worker) On

func (w *Worker) On(c astibob.DispatchConditions, h astibob.MessageHandler)

On makes sure to handle messages with specific conditions

func (*Worker) RegisterListenables

func (w *Worker) RegisterListenables(ls ...Listenable)

func (*Worker) RegisterRunnables

func (w *Worker) RegisterRunnables(rs ...Runnable)

func (*Worker) RegisterToIndex

func (w *Worker) RegisterToIndex()

Register registers the worker to the index

func (*Worker) SendMessage

func (w *Worker) SendMessage(o MessageOptions) (err error)

func (*Worker) Serve

func (w *Worker) Serve()

func (*Worker) Wait

func (w *Worker) Wait()

Wait waits for the index to be stopped

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL