async

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2018 License: Apache-2.0 Imports: 7 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 Component added in v0.4.2

type Component struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Component implementation of a async component.

func New added in v0.4.2

func New(p ProcessorFunc, cns Consumer) (*Component, error)

New returns a new 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.

func (*Component) Shutdown added in v0.4.2

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

Shutdown gracefully the component by closing the consumer.

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 Message added in v0.2.0

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

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