worker

package
v0.16.4 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App interface {
	AppName() string
	Handlers() map[string]Handler
}

type AppWorker added in v0.15.1

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

func NewAppWorker added in v0.15.1

func NewAppWorker(appName string, handlers Handlers, bufferSize int, natsClient *nats.Client, logger Logger) *AppWorker

func (*AppWorker) Run added in v0.15.1

func (a *AppWorker) Run(ctx context.Context)

type Executor added in v0.15.1

type Executor func(context.Context) (interface{}, error)

type Handler

type Handler func(context.Context, jetstream.Msg) error

TODO: Update function to return a pointer to a ResultMsg

type HandlerFunc added in v0.15.1

type HandlerFunc func([]byte, *nats.MsgMeta) (Executor, error)

type Handlers added in v0.15.1

type Handlers map[string]HandlerFunc

type Logger

type Logger interface {
	// Log a debug statement
	Debugf(format string, v ...interface{})

	// Log an error with exact error
	Errf(err error, format string, v ...interface{})

	// Log an error
	Errorf(format string, v ...interface{})

	// Log a fatal error
	Fatalf(format string, v ...interface{})

	// Log an info statement
	Infof(format string, v ...interface{})

	// Log a notice statement
	Noticef(format string, v ...interface{})

	// Log a trace statement
	Tracef(format string, v ...interface{})

	// Log a warning statement
	Warnf(format string, v ...interface{})
}

type Worker deprecated

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

Deprecated: Use AppWorker instead

func NewWorker deprecated

func NewWorker(natsClient *nats.Client, app App, logger Logger) *Worker

Deprecated: Use NewAppWorker instead

func (*Worker) Run

func (w *Worker) Run(ctx context.Context) error

Jump to

Keyboard shortcuts

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