pgqueue

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: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDefaultLogger

func SetDefaultLogger() pgq.WorkerOption

func SqlConnect

func SqlConnect(ctx context.Context, dbConnection string) (*sql.DB, *pgq.Worker, error)

Types

type CallbackWithContext

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

type Consumer

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

Consumer implements messaging.Consumer and interface.autoscaler.qbas.Queue

func NewConsumer

func NewConsumer(db *sql.DB, queueName string, opts ...ConsumerOption) *Consumer

NewConsumer returns a pg queue consumer. A consumer cannot share the worker with another instance

func (*Consumer) Backlog

func (c *Consumer) Backlog(ctx context.Context) (int64, error)

Backlog implements interface.autoscaler.qbas.Queue

func (*Consumer) Pull

func (c *Consumer) Pull(ctx context.Context, cb messaging.Callback) error

Pull implements Consumer

func (*Consumer) Stop

func (c *Consumer) Stop()

type ConsumerOption

type ConsumerOption func(o *Consumer)

type Publisher

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

Publisher implements messaging.Publisher

func NewPublisher

func NewPublisher(w *pgq.Worker, queueName string, opts ...PublisherOption) *Publisher

NewPublisher returns a pg queue publisher. A publisher can share its worker with another instance

func (*Publisher) Publish

func (p *Publisher) Publish(ctx context.Context, data ...[]byte) error

Publish implements Publisher

type PublisherOption

type PublisherOption func(o *Publisher)

func WithJobRetryWaits added in v1.0.1

func WithJobRetryWaits(waits []time.Duration) PublisherOption

func WithMaxRetries

func WithMaxRetries(maxRetries int) PublisherOption

Jump to

Keyboard shortcuts

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