queue

package
v0.0.0-...-0eb6aec Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2017 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GCPPubSubQueue

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

GCPPubSubQueue is a queue using Google Compute Platform's PubSub product.

func NewGCPPubSubQueue

func NewGCPPubSubQueue(ctx context.Context, logger logger.Logger, projectID, topicName string) (*GCPPubSubQueue, error)

NewGCPPubSubQueue creates connects to Google Pub/Sub with a topic and subscriber in a one-to-one architecture.

func (GCPPubSubQueue) Wait

func (q GCPPubSubQueue) Wait(ctx context.Context, wg *sync.WaitGroup, queuePush <-chan interface{}, f func(interface{}))

Wait waits for messages on queuePush and adds them to the Pub/Sub queue. Upon receiving messages from Pub/Sub, f is invoked with the message. Wait is non-blocking, increments wg for each routine started, and when context is closed will mark the wg as done as routines are shutdown.

type MemoryQueue

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

MemoryQueue is an in memory queue of infinite size.

func NewMemoryQueue

func NewMemoryQueue(logger logger.Logger) *MemoryQueue

NewMemoryQueue creates a new in memory queue

func (*MemoryQueue) Wait

func (q *MemoryQueue) Wait(ctx context.Context, wg *sync.WaitGroup, queuePush <-chan interface{}, f func(interface{}))

Wait waits for messages on queuePush and adds them to the queue. New message are checked for regularly and when a new message is ready f will be called with the argument of the job.

Jump to

Keyboard shortcuts

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