queue

package
v2.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package queue provides a queue interface

Package queue provides a common queue interface

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrorScanCancel can be returned by the scan handler to stop scanning
	ErrorScanCancel = Error(errors.New("scan canceled"))
)

Functions

func RegisterProvider

func RegisterProvider(name string, provider NewFunc)

RegisterProvider makes a database provider available by the provided name. If RegisterProvider is called twice with the same name or if provider is nil, it panics.

Types

type Error

type Error error

Error is a queue error type

type Message

type Message interface {
	// MessageID returns a unique message identifier
	MessageID() string

	// Body returns the message body as []byte
	Body() []byte

	// Attributes returns the message attributes as a map
	Attributes() types.StringMap
}

Message is a queue message interface

type NewFunc

type NewFunc func(name string, params types.StringMap) (Provider, error)

NewFunc intializes the provider

type Provider

type Provider interface {
	// Publish publishes the message body with optioanl attributes and return the id
	Publish(body []byte, attributes ...types.StringMap) (string, error)

	// Scan performs a canceleable scan on the queue
	Scan(ctx context.Context, handler func(msg Message) error) error
}

Provider defines a queue interface

func MustOpen

func MustOpen(uri string) Provider

MustOpen will panic on fail

func Open

func Open(uri string) (Provider, error)

Open opens a new auth provider

Directories

Path Synopsis
providers
sqs

Jump to

Keyboard shortcuts

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