queue

package
v0.0.0-...-8c3a927 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	Infof(context.Context, string, ...interface{})
	Warnf(context.Context, error, string, ...interface{})
	Errorf(context.Context, error, string, ...interface{})
}

Logger is a simple logger abstraction so that clients can provide their own logger

type Queue

type Queue interface {
	PostEvent(ctx context.Context, json string) error
	SubscribeEvents(ctx context.Context, handlerFn func(ev *qapi.EventMsg) error, closeFn func()) error
	AckEvent(ctx context.Context, userToken string, success bool) error
	Close(ctx context.Context)
}

Queue defines a set of operations to interact with the queue

func NewQueue

func NewQueue(serverAddr string, apiAttempts int, clientID string, searchKey1 int64, searchKey2 int64, keepAlive bool, logger Logger, grpcOpts []grpc.DialOption) (Queue, error)

NewQueue creates a new queue instance Returns an error if it's not able to create a transport

type State

type State int

State defines the state of the queue

const (
	// Closed is the unitial state prior we called SubscribeEvents or after we have called Close
	Closed State = iota
	// Connected means a successfully connected state
	Connected
	// Disconnected means the Go routine receiving stream events got an error
	Disconnected
)

Jump to

Keyboard shortcuts

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