Documentation ¶
Index ¶
- Constants
- type ConfigurationConsumer
- type DialOptions
- type ExecHandler
- type ExecOptions
- type SignalHandler
- type Task
- type TaskFunc
- type Worker
- func (w *Worker) Consume(a *astiamqp.AMQP, cs ...ConfigurationConsumer) (err error)
- func (w *Worker) Context() context.Context
- func (w *Worker) Dial(o DialOptions)
- func (w *Worker) Exec(o ExecOptions) (ExecHandler, error)
- func (w *Worker) HandleSignals(hs ...SignalHandler)
- func (w *Worker) NewTask() *Task
- func (w *Worker) Serve(addr string, h http.Handler)
- func (w *Worker) Stop()
- func (w *Worker) Wait()
Constants ¶
const ( StatusCrashed = "crashed" StatusRunning = "running" StatusStopped = "stopped" )
Statuses
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigurationConsumer ¶
type ConfigurationConsumer struct { AMQP astiamqp.ConfigurationConsumer WorkerCount int }
ConfigurationConsumer represents a consumer configuration
type DialOptions ¶ added in v1.1.0
type DialOptions struct { Addr string Client *astiws.Client Header http.Header OnDial func() error OnReadError func(err error) }
DialOptions represents dial options
type ExecHandler ¶
type ExecHandler interface { Status() string Stop() }
ExecHandler represents an object capable of handling the execution of a cmd
type ExecOptions ¶ added in v1.2.1
type SignalHandler ¶ added in v1.2.1
SignalHandler represents a func that can handle a signal
func TermSignalHandler ¶ added in v1.2.1
func TermSignalHandler(f func()) SignalHandler
TermSignalHandler returns a SignalHandler that is executed only on a term signal
type TaskFunc ¶ added in v1.2.0
type TaskFunc func() *Task
TaskFunc represents a function that can create a new task
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker represents an object capable of blocking, handling signals and stopping
func (*Worker) Consume ¶
func (w *Worker) Consume(a *astiamqp.AMQP, cs ...ConfigurationConsumer) (err error)
Consume consumes AMQP events
func (*Worker) Dial ¶ added in v1.1.0
func (w *Worker) Dial(o DialOptions)
Dial dials with options It's the responsibility of the caller to close the Client
func (*Worker) Exec ¶
func (w *Worker) Exec(o ExecOptions) (ExecHandler, error)
Exec executes a cmd The process will be stopped when the worker stops
func (*Worker) HandleSignals ¶
func (w *Worker) HandleSignals(hs ...SignalHandler)
HandleSignals handles signals