Skip to content

Latest commit

 

History

History
25 lines (20 loc) · 929 Bytes

README.md

File metadata and controls

25 lines (20 loc) · 929 Bytes

Worker Queues

Godoc

This implements a Queue interface for worker processes backed by a queue service like Azure Service Bus queues or Amazon SQS. It looks like this:

//Queue is a request queue for worker processes. A worker gets the Next() item in the queue, does some work based on that item, and either calls
//Succeed() or Fail() depending on the outcome. Note that Fail() returns the item to the queue.
//Send() enqueues a new item.
type Queue interface {
	Next() (*Item, error)
	Send(*Item) error
	Succeed(*Item) error
	Fail(*Item) error
}


//Item is a generic item in a queue.
type Item struct {
	ID        string //Unique item ID, assigned by the queuing service.
	LockToken string //Lock token held by the worker while it processing the message, assigned by the queueing service (called Receipt Handle in AWS).
	Request   []byte //Request payload.
}