- Notifications
You must be signed in to change notification settings - Fork13
Queue is a generic interface to abstract the details of implementation of queue systems.
License
src-d/go-queue
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Queue is a generic interface to abstract the details of implementation of queuesystems.
Similar to the packagedatabase/sql,this package implements a common interface to interact with different queuesystems, in a unified way.
Currently, only AMQP queues and an in-memory queue are supported.
The recommended way to installgo-queue is:
go get -u gopkg.in/src-d/go-queue.v1/...This example shows how to publish and consume a Job from the in-memoryimplementation, very useful for unit tests.
The queue implementations to be supported by theNewBroker should be importedas shows the example.
import (..."gopkg.in/src-d/go-queue.v1"_"gopkg.in/src-d/go-queue.v1/memory")...b,_:=queue.NewBroker("memory://")q,_:=b.Queue("test-queue")j,_:=queue.NewJob()iferr:=j.Encode("hello world!");err!=nil {log.Fatal(err)}iferr:=q.Publish(j);err!=nil {log.Fatal(err)}iter,err:=q.Consume(1)iferr!=nil {log.Fatal(err)}consumedJob,_:=iter.Next()varpayloadstring_=consumedJob.Decode(&payload)fmt.Println(payload)// Output: hello world!
The list of available variables is:
AMQP_BACKOFF_MIN(default: 20ms): Minimum time to wait for retry the connection or queue channel assignment.AMQP_BACKOFF_MAX(default: 30s): Maximum time to wait for retry the connection or queue channel assignment.AMQP_BACKOFF_FACTOR(default: 2): Multiplying factor for each increment step on the retry.AMQP_BURIED_QUEUE_SUFFIX(default:.buriedQueue): Suffix for the buried queue name.AMQP_BURIED_EXCHANGE_SUFFIX(default:.buriedExchange): Suffix for the exchange name.AMQP_BURIED_TIMEOUT(default: 500): Time in milliseconds to wait for new jobs from the buried queue.AMQP_RETRIES_HEADER(default:x-retries): Message header to set the number of retries.AMQP_ERROR_HEADER(default:x-error-type): Message header to set the error type.
Apache License Version 2.0, seeLICENSE
About
Queue is a generic interface to abstract the details of implementation of queue systems.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors11
Uh oh!
There was an error while loading.Please reload this page.