class Amber::Jobs::Configuration

Overview

Configuration settings for the background jobs system.

This class holds all configurable options for job processing, including the adapter type, queue names, worker count, polling interval, and work-stealing behavior.

Usage

Configuration is typically set through Amber::Server.configure:

Amber::Server.configure do |app|
  app.jobs.adapter = :memory
  app.jobs.queues = ["default", "critical", "low"]
  app.jobs.workers = 2
  app.jobs.work_stealing_enabled = true
  app.jobs.polling_interval = 1.second
end

Or accessed directly:

config = Amber::Jobs.configuration
config.workers = 4

Defined in:

amber/jobs/configuration.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def adapter : Symbol #

The adapter type for job queue storage. Default: :memory


[View source]
def adapter=(adapter : Symbol) #

The adapter type for job queue storage. Default: :memory


[View source]
def is_auto_start_enabled=(is_auto_start_enabled : Bool) #

Whether the jobs system should automatically start workers when the Amber server starts. Default: false


[View source]
def is_auto_start_enabled? : Bool #

Whether the jobs system should automatically start workers when the Amber server starts. Default: false


[View source]
def is_work_stealing_enabled=(is_work_stealing_enabled : Bool) #

Whether idle web server instances should process background jobs. When enabled, the web server spawns additional workers that only pick up jobs when no HTTP requests are pending. Default: false


[View source]
def is_work_stealing_enabled? : Bool #

Whether idle web server instances should process background jobs. When enabled, the web server spawns additional workers that only pick up jobs when no HTTP requests are pending. Default: false


[View source]
def list_of_queues : Array(String) #

The list of queue names to process, in priority order. Workers will check queues in this order, processing the first available job. Default: ["default"]


[View source]
def list_of_queues=(list_of_queues : Array(String)) #

The list of queue names to process, in priority order. Workers will check queues in this order, processing the first available job. Default: ["default"]


[View source]
def number_of_workers : Int32 #

The number of worker fibers to spawn. Default: 1


[View source]
def number_of_workers=(number_of_workers : Int32) #

The number of worker fibers to spawn. Default: 1


[View source]
def polling_interval : Time::Span #

How frequently workers poll the queue adapter for available jobs. Default: 1.second


[View source]
def polling_interval=(polling_interval : Time::Span) #

How frequently workers poll the queue adapter for available jobs. Default: 1.second


[View source]
def queues : Array(String) #

Convenience getter that returns queue names.


[View source]
def queues=(list_of_queues : Array(String)) #

Convenience setter that accepts an array of strings for queue names.


[View source]
def scheduler_interval : Time::Span #

How frequently the scheduler checks for jobs ready to be promoted. Default: 5.seconds


[View source]
def scheduler_interval=(scheduler_interval : Time::Span) #

How frequently the scheduler checks for jobs ready to be promoted. Default: 5.seconds


[View source]
def work_stealing_enabled=(value : Bool) #

Convenience setter for work stealing.


[View source]
def work_stealing_enabled? : Bool #

Convenience getter for work stealing.


[View source]
def workers : Int32 #

Convenience getter for number of workers.


[View source]
def workers=(count : Int32) #

Convenience setter for number of workers.


[View source]