Documentation
¶
Index ¶
Constants ¶
View Source
const ( PluginName string = "boltdb" PushBucket string = "push" InQueueBucket string = "processing" DelayBucket string = "delayed" )
Variables ¶
This section is empty.
Functions ¶
func FromPipeline ¶
func NewBoltDBJobs ¶
func NewBoltDBJobs(configKey string, log logger.Logger, cfg config.Configurer, e events.Handler, pq priorityqueue.Queue) (*consumer, error)
Types ¶
type Config ¶
type Config struct { File string `mapstructure:"file"` Priority int `mapstructure:"priority"` Prefetch int `mapstructure:"prefetch"` }
func (*Config) InitDefaults ¶
func (c *Config) InitDefaults()
type GlobalCfg ¶
type GlobalCfg struct { // db file permissions Permissions int `mapstructure:"permissions"` }
func (*GlobalCfg) InitDefaults ¶
func (c *GlobalCfg) InitDefaults()
type Item ¶
type Item struct { // Job contains pluginName of job broker (usually PHP class). Job string `json:"job"` // Ident is unique identifier of the job, should be provided from outside Ident string `json:"id"` // Payload is string data (usually JSON) passed to Job broker. Payload string `json:"payload"` // Headers with key-values pairs Headers map[string][]string `json:"headers"` // Options contains set of PipelineOptions specific to job execution. Can be empty. Options *Options `json:"options,omitempty"` }
func (*Item) Requeue ¶
Requeue algorithm:
- Rewrite item headers and delay.
- Begin writable transaction on attached to the item db.
- Delete item from the InQueueBucket
- Handle items with the delay: 4.1. Get DelayBucket 4.2. Make a key by adding the delay to the time.Now() in RFC3339 format 4.3. Put this key with value to the DelayBucket
- W/o delay, put the key with value to the PushBucket (requeue)
type Options ¶
type Options struct { // Priority is job priority, default - 10 // pointer to distinguish 0 as a priority and nil as priority not set Priority int64 `json:"priority"` // Pipeline manually specified pipeline. Pipeline string `json:"pipeline,omitempty"` // Delay defines time duration to delay execution for. Defaults to none. Delay int64 `json:"delay,omitempty"` // contains filtered or unexported fields }
Options carry information about how to handle given job.
Click to show internal directories.
Click to hide internal directories.