queue

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 License: AGPL-3.0 Imports: 6 Imported by: 6

Documentation

Index

Constants

View Source
const (

	// DefaultPriority is the default priority for tasks
	DefaultPriority = Priority(0)

	// HighPriority is the highest priority for tasks
	HighPriority = Priority(-10000000)

	// LowPriority is the lowest priority for tasks
	LowPriority = Priority(+10000000)

	// BatchQueue is our queue for batch tasks, most things that operate on more than one cotact at a time
	BatchQueue = "batch"

	// HandlerQueue is our queue for message handling or other tasks related to just one contact
	HandlerQueue = "handler"

	// SendBroadcast is our type for sending a broadcast
	SendBroadcast = "send_broadcast"

	// SendBroadcastBatch is our type for sending a broadcast batch
	SendBroadcastBatch = "send_broadcast_batch"

	// FireCampaignEvent is our type for firing a campaign event
	FireCampaignEvent = "fire_campaign_event"

	// HandleContactEvent is our task for event handling
	HandleContactEvent = "handle_contact_event"

	// StartFlow is our task type to start a flow
	StartFlow = "start_flow"

	// StartFlowBatch is our task for starting a flow batch
	StartFlowBatch = "start_flow_batch"

	// StartIVRFlowBatch is our task for starting an ivr batch
	StartIVRFlowBatch = "start_ivr_flow_batch"
)

Variables

This section is empty.

Functions

func AddTask

func AddTask(rc redis.Conn, queue string, taskType string, orgID int, task interface{}, priority Priority) error

AddTask adds the passed in task to our queue for execution

func MarkTaskComplete

func MarkTaskComplete(rc redis.Conn, queue string, orgID int) error

MarkTaskComplete marks the passed in task as complete. Callers must call this in order to maintain fair workers across orgs

func Size added in v0.0.118

func Size(rc redis.Conn, queue string) (int, error)

Size returns the number of tasks for the passed in queue

Types

type Priority

type Priority int

Priority is the priority for the task

type Task

type Task struct {
	Type       string          `json:"type"`
	OrgID      int             `json:"org_id"`
	Task       json.RawMessage `json:"task"`
	QueuedOn   time.Time       `json:"queued_on"`
	ErrorCount int             `json:"error_count,omitempty"`
}

Task is a utility struct for encoding a task

func PopNextTask

func PopNextTask(rc redis.Conn, queue string) (*Task, error)

PopNextTask pops the next task off our queue

Jump to

Keyboard shortcuts

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