Skip to content

michaelbironneau/queue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.
}

About

Golang worker queues backed by a cloud service such as Azure Service Bus.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages