amqp

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2019 License: MIT Imports: 9 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 represents AMQP broker.

func (*Broker) Consume

func (b *Broker) Consume(pipe *jobs.Pipeline, execPool chan jobs.Handler, errHandler jobs.ErrorHandler) error

Consume configures pipeline to be consumed. With execPool to nil to disable consuming. Method can be called before the service is started!

func (*Broker) Init

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

Init configures AMQP job broker (always 2 connections).

func (*Broker) Listen

func (b *Broker) Listen(lsn func(event int, ctx interface{}))

Listen attaches server event watcher.

func (*Broker) Push

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

Push job into the worker.

func (*Broker) Register

func (b *Broker) Register(pipe *jobs.Pipeline) error

Register broker pipeline.

func (*Broker) Serve

func (b *Broker) Serve() (err error)

Serve broker pipelines.

func (*Broker) Stat

func (b *Broker) Stat(pipe *jobs.Pipeline) (stat *jobs.Stat, err error)

Stat must fetch statistics about given pipeline or return error.

func (*Broker) Stop

func (b *Broker) Stop()

Stop all pipelines.

type Config

type Config struct {
	// Addr of AMQP server (example: amqp://guest:guest@localhost:5672/).
	Addr string

	// Timeout to allocate the connection. Default 10 seconds.
	Timeout int
}

Config defines sqs broker configuration.

func (*Config) Hydrate

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

Hydrate config values.

func (*Config) TimeoutDuration

func (c *Config) TimeoutDuration() time.Duration

TimeoutDuration returns number of seconds allowed to allocate the publish.

Jump to

Keyboard shortcuts

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