memory

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() mq.Broker

New creates a new Broker for an in-memory queue.

func NewFinite

func NewFinite(finite bool) mq.Broker

NewFinite creates a new Broker for an in-memory queue. The argument specifies if the JobIter stops on EOF or not.

Types

type Acknowledger

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

Acknowledger implements a queue.Acknowledger interface.

func (*Acknowledger) Ack

func (a *Acknowledger) Ack() error

Ack is called when the Job has finished.

func (*Acknowledger) Reject

func (a *Acknowledger) Reject(requeue bool) error

Reject is called when the Job has errored. The argument indicates whether the Job should be put back in queue or not. If requeue is false, the job will go to the buried queue until Queue.RepublishBuried() is called.

type Broker

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

Broker is a in-memory implementation of Broker.

func (*Broker) Close

func (b *Broker) Close() error

Close closes the connection in the Broker.

func (*Broker) Queue

func (b *Broker) Queue(name string) (mq.Queue, error)

Queue returns the queue with the given name.

type JobIter

type JobIter struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

JobIter implements a queue.JobIter interface.

func (*JobIter) Close

func (i *JobIter) Close() error

Close closes the iter.

func (*JobIter) Next

func (i *JobIter) Next() (*mq.Job, error)

Next returns the next job in the iter.

type Queue

type Queue struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Queue implements a queue.Queue interface.

func (*Queue) Consume

func (q *Queue) Consume(advertisedWindow int) (mq.JobIter, error)

Consume implements Queue. The advertisedWindow value is the maximum number of unacknowledged jobs. Use 0 for an infinite window.

func (*Queue) Publish

func (q *Queue) Publish(j *mq.Job) error

Publish publishes a Job to the queue.

func (*Queue) PublishDelayed

func (q *Queue) PublishDelayed(j *mq.Job, delay time.Duration) error

PublishDelayed publishes a Job to the queue with a given delay.

func (*Queue) RepublishBuried

func (q *Queue) RepublishBuried(conditions ...mq.RepublishConditionFunc) error

RepublishBuried implements the Queue interface.

func (*Queue) Transaction

func (q *Queue) Transaction(txcb mq.TxCallback) error

Transaction calls the given callback inside a transaction.

Jump to

Keyboard shortcuts

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