JoobQ::Configure
Inherits Reference < Object
Configure is responsible for managing the settings for the JoobQ job queue system.
Features
- Centralizes job queue configurations, Redis connection setup, and queue properties.
- Provides default settings and allows easy customization through environment variables.
- Supports defining queues, middlewares, throttling, and scheduling jobs.
Usage Example
JoobQ::Configure.instance.queue "my_queue", 5, MyJob, {limit: 10, period: 1.minute}
Constructors
YAML configuration loading methods
Load from multiple YAML sources with merging
Class methods
Instance methods
Whether a payload property that is not sealed (written before it was encrypted) is read as it is.
Whether a payload property that is not sealed (written before it was encrypted) is read as it is.
Create queues from stored queue_configs using the QueueFactory
This method bridges YAML configuration with actual queue instantiation. It should be called after:
- YAML configuration is loaded
- Job classes are defined and available
- Job types are registered with QueueFactory
Example:
# Load YAML config
config = Configure.load_from_yaml("config/joobq.yml")
# Register job types (must be done after job classes are defined)
QueueFactory.register_job_type(EmailJob)
QueueFactory.register_job_type(ImageProcessingJob)
# Create queues from YAML configuration
config.create_queues_from_yaml_config
# Now queues are available
JoobQ.start
Delayed job scheduler (processes retrying jobs)
Configure error monitoring with parameters
Sets the payload encryption keys: current seals and opens, each of previous only opens. Entries are
id:key (32 bytes as 64 hex digits or base64).
Keys for encrypted_property (see JoobQ::Encryption); when nil, JOOBQ_PAYLOAD_KEYS / JOOBQ_PAYLOAD_KEY.
Keys for encrypted_property (see JoobQ::Encryption); when nil, JOOBQ_PAYLOAD_KEYS / JOOBQ_PAYLOAD_KEY.
Pipeline optimization settings (always enabled)
Add a scheduler and execute within its context
Helper method to setup schedulers from YAML configuration
This method should be called after job classes are available and loaded. It processes the scheduler configurations stored during YAML loading and sets up cron jobs and recurring jobs with proper job class resolution.
Example usage:
config = JoobQ::Configure.load_from_yaml("config/joobq.yml")
# ... load job classes ...
config.setup_schedulers_from_config
True once a configuration source (a YAML redis section) chose the store, as opposed to the default built from
the environment. Merging sources keeps a chosen store whichever source comes last.
True once a configuration source (a YAML redis section) chose the store, as opposed to the default built from
the environment. Merging sources keeps a chosen store whichever source comes last.
Set the time location globally
Validate Redis pool size against configured workers (call after queues are set up)
Macros
Macro: Define a queue
Adds a queue configuration and optionally applies throttling limits.
Helper macro to register a job type and add it to the factory
This combines job registry and queue factory registration in one call.
Example:
config = JoobQ.config
config.register_job(EmailJob)
config.register_job(ImageProcessingJob)