beanstalk

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

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

Broker run jobs using Broker service.

func (*Broker) Init

func (b *Broker) Init(cfg *Config) (bool, error)

Init configures local job broker.

func (*Broker) Listen

func (b *Broker) Listen(pipelines []*jobs.Pipeline, pool chan jobs.Handler, err jobs.ErrorHandler) error

Listen configures broker with list of tubes to listen and handler function. Local broker groups all tubes together.

func (*Broker) Push

func (b *Broker) Push(p *jobs.Pipeline, j *jobs.Job) (string, error)

Push new job to queue

func (*Broker) Serve

func (b *Broker) Serve() error

Serve tubes.

func (*Broker) Stop

func (b *Broker) Stop()

Stop serving.

type Config

type Config struct {
	// Address of beanstalk server.
	Address string

	// Reserve timeout in seconds.
	Reserve int
}

Config defines beanstalk broker configuration.

func (*Config) Conn

func (c *Config) Conn() (*beanstalk.Conn, error)

Conn creates new rpc socket Listener.

func (*Config) Hydrate

func (c *Config) Hydrate(cfg service.Config) error

Hydrate config values.

type Tube

type Tube struct {
	*beanstalk.Tube

	// Indicates that tube must be listened.
	Listen bool
}

Tube connects with singular queue channel in beanstalk.

func NewTube

func NewTube(p *jobs.Pipeline) (*Tube, error)

NewTube creates new tube or returns an error

Jump to

Keyboard shortcuts

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