Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrEmptyQueue is returned when the queue is empty ErrEmptyQueue = errors.New("the queue is empty or does not exists") TopicJobsNew = "darko:jobs:new" TopicJobsProcessed = "darko:jobs:processed" TopicJobsFailed = "darko:jobs:failed" )
Functions ¶
Types ¶
type Job ¶
type Job struct {
// ID is the job unique id. Set by the server.
ID string
// PartitionKey is the partition id this job belongs to. Set by the server.
PartitionKey int
// PrimaryKey is the primary key.
// It is used to guarantee the order of the requests and balance the work load.
PrimaryKey string `json:"primary_key"`
// CallbackURL is the service endpoint to send the payload back to.
CallbackURL string `json:"callback_url"`
// CorrelationID is a unique identifier attached to the request by the client that allow
// reference to a particular transaction or event chain.
CorrelationID string `json:"correlation_id"`
// Payload with the content encoded as base64 that will be forwarded on the client on the callback.
Payload string `json:"payload"`
}
Job holds data for creating jobs. A job defines something that will be queued and dequeued. In HA mode, a job will also be uniform partitioned on shards.
func (Job) NewPayloadReader ¶
type Queue ¶
type Queue interface {
// Pop dequeue the next item of the topic.
Pop(topic string) (string, error)
// Push enqueues the item,
Push(topic string, pack string) error
}
Queue defines a FIFO queue interface
type RedisQueue ¶
type RedisQueue struct {
// contains filtered or unexported fields
}
RedisQueue implements the Queue interface using Redis database as queue.
func NewRedisQueue ¶
func NewRedisQueue(cli *redis.Client, blockTimeout time.Duration) *RedisQueue
NewRedisQueue returns a RedisQueue.
Click to show internal directories.
Click to hide internal directories.