messaging

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: Apache-2.0 Imports: 5 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Consume added in v0.5.0

func Consume(req http.Request, cb Callback) (int, error)

Consume the request, call callback and return http code (pushing mode)

Types

type Callback

type Callback func(ctx context.Context, m *Message) error

Callback is a function that processes a Message.

type Consumer

type Consumer interface {
	// Pull the next message, call callback and return
	// If callback returns a temporary error, the message must be rescheduled, increasing its trycount
	Pull(ctx context.Context, cb Callback) error
}

Consumer is an interface to consume messages

type Message

type Message struct {
	ID          string
	Data        []byte
	Attributes  map[string]string
	PublishTime time.Time
	TryCount    int
}

type Publisher

type Publisher interface {
	Publish(ctx context.Context, data ...[]byte) error
}

Publisher is an interface to publish messages

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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