runner

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExitTimeout     = -1
	ExitACK         = 0
	ExitFailed      = 1
	ExitNACK        = 3
	ExitNACKRequeue = 4
	ExitRetry       = 5
)

Exit constants used to know how handle the message. The consumer runnig is the responsible to understand this status and handle them properly.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Type         string        `mapstructure:"type"`
	IgnoreOutput bool          `mapstructure:"ignore-output"`
	Options      Options       `mapstructure:"options"`
	Timeout      time.Duration `mapstructure:"timeout"`
}

Config is an composition of options and configurations used by this runnables.

type Options

type Options struct {
	// Command options
	Path string   `mapstructure:"path"`
	Args []string `mapstructure:"args"`
	// HTTP options
	URL         string `mapstructure:"url"`
	ReturnOn5xx int    `mapstructure:"return-on-5xx" default:"4"`
	Headers     map[string]string
}

Options is a composition os all options used internally by runners. options not needed by one runner will be ignored.

type Runnable

type Runnable interface {
	Process(context.Context, []byte) int
}

Runnable represent an runnable used by consumers to handle messages.

func New

func New(log *zap.Logger, c Config) (Runnable, error)

New create and return a Runnable based on the config type. if the type didn't exist an error is returned.

Jump to

Keyboard shortcuts

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