message

package
v0.5.0-beta2.6 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 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 Acker

type Acker interface {
	Ack(ctx context.Context)
}

type Handler

type Handler interface {
	HandleMessage(ctx context.Context, topic string, msg Message) error
	Name() string
}

type InputMessage

type InputMessage struct {
	Topic string
	Message
	Acker Acker
}

func (InputMessage) Ack

func (msg InputMessage) Ack(ctx context.Context)

type Message

type Message struct {
	UID       string
	Partition int64
	PayLoad   []byte
	Head      map[string]string
}

type Middle

type Middle interface {
	Warp(handler Handler) Handler
}

type OutputMessage

type OutputMessage struct {
	OffsetToken string
	Topic       string
	Message
}

type RetryMiddle

type RetryMiddle struct {
	CheckRetry    func(err error) bool
	MaxRetryCount int
}

func (RetryMiddle) Warp

func (middle RetryMiddle) Warp(handler Handler) Handler

type Router

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

func NewRouter

func NewRouter(option RouterOption, subs ...Subscriber) (*Router, error)

func (*Router) AddHandler

func (router *Router) AddHandler(topic string, handler Handler) error

func (*Router) Start

func (router *Router) Start(ctx context.Context) error

type RouterOption

type RouterOption struct {
	Middles []Middle
}

type Subscriber

type Subscriber interface {
	Topic() string
	Read(ctx context.Context) (InputMessage, error)
	Close() error
}

type TimeOutMiddle

type TimeOutMiddle struct {
	TimeOut time.Duration
}

func (TimeOutMiddle) Warp

func (middle TimeOutMiddle) Warp(handler Handler) Handler

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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