supervisor

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

type Consumer interface {
	// Run will get the messages and pass to the runner.
	Run()

	// Kill will try to stop the internal work. Return an error in case of failure.
	Kill() error

	// Alive returns true if the tomb is not in a dying or dead state.
	Alive() bool

	// Name return the consumer name
	Name() string

	// FactoryName is the name of the factory responsible for this consumer.
	FactoryName() string
}

Consumer consume messages and pass to workers who will process the messages.

type Factory

type Factory interface {
	// CreateConsumers will iterate over config and create all the consumers
	CreateConsumers() ([]Consumer, error)

	// CreateConsumer create a new consumer for a specific name using the config provided.
	CreateConsumer(name string) (Consumer, error)

	// Name return the factory name
	Name() string
}

Factory create consumers

type Manager

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

Manager is the block responsible for creating all the consumers. Keeping track of the current state of consumers and stop/restart consumers when needed.

func NewManager

func NewManager(intervalChecks time.Duration, hub *hub.Hub) *Manager

NewManager init a new manager and wait for operations.

func (*Manager) Start

func (m *Manager) Start(fs []Factory) error

Start all the consumers from factories

func (*Manager) Stop

func (m *Manager) Stop() error

Stop all the consumers

type MultiError

type MultiError []error

MultiError is returned by batch operations when there are errors with particular elements. Errors will be in a one-to-one correspondence with the input elements; successful elements will have a nil entry.

func (MultiError) Error

func (m MultiError) Error() string

Jump to

Keyboard shortcuts

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