async

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetermineDecoder added in v0.2.0

func DetermineDecoder(contentType string) (encoding.DecodeRawFunc, error)

DetermineDecoder determines the decoder based on the content type.

Types

type Builder added in v0.31.0

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

Builder gathers all required properties in order to construct a component

func New added in v0.4.2

func New(name string, cf ConsumerFactory, proc ProcessorFunc) *Builder

New initializes a new builder for a component with the given name by default the failStrategy will be NackExitStrategy.

func (*Builder) Create added in v0.31.0

func (cb *Builder) Create() (*Component, error)

Create constructs the Component applying

func (*Builder) WithFailureStrategy added in v0.31.0

func (cb *Builder) WithFailureStrategy(fs FailStrategy) *Builder

WithFailureStrategy defines the failure strategy to be used default value is NackExitStrategy it will append an error to the builder if the strategy is not one of the pre-defined ones.

func (*Builder) WithRetries added in v0.31.0

func (cb *Builder) WithRetries(retries uint) *Builder

WithRetries specifies the retry events number for the component default value is '0'.

func (*Builder) WithRetryWait added in v0.31.0

func (cb *Builder) WithRetryWait(retryWait time.Duration) *Builder

WithRetryWait specifies the duration for the component to wait between retries default value is '0' it will append an error to the builder if the value is smaller than '0'.

type Component added in v0.4.2

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

Component implementation of a async component.

func (*Component) Run added in v0.4.2

func (c *Component) Run(ctx context.Context) error

Run starts the consumer processing loop messages.

type Consumer added in v0.4.2

type Consumer interface {
	Consume(context.Context) (<-chan Message, <-chan error, error)
	Close() error
}

Consumer interface which every specific consumer has to implement.

type ConsumerFactory added in v0.23.0

type ConsumerFactory interface {
	Create() (Consumer, error)
}

ConsumerFactory interface for creating consumers.

type FailStrategy added in v0.23.0

type FailStrategy int

FailStrategy type definition.

const (
	// NackExitStrategy does not acknowledge the message and exits the application on error.
	NackExitStrategy FailStrategy = iota
	// NackStrategy does not acknowledge the message, leaving it for reprocessing, and continues.
	NackStrategy
	// AckStrategy acknowledges message and continues.
	AckStrategy
)

type Message added in v0.2.0

type Message interface {
	Context() context.Context
	Decode(v interface{}) error
	Ack() error
	Nack() error
	Source() string
}

Message interface for defining messages that are handled by the async component.

type ProcessorFunc added in v0.3.1

type ProcessorFunc func(Message) error

ProcessorFunc definition of a async processor.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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