class JoobQ::Configure
- JoobQ::Configure
- Reference
- Object
Overview
This struct is responsible for configuring and managing settings for the JoobQ job queue system.
Properties and Getters
INSTANCE: A constant that holds a singleton instance of theConfigurestruct.redis: A getter that returns aRedis::PooledClientinstance. The Redis client is configured using environment variables, including host, port, password, pool size, and timeout settings.#queues: A getter returning a hash mapping queue names to their correspondingBaseQueueinstances.stats_enabled: A property indicating whether statistics tracking is enabled. Defaults tofalse.#default_queue: A property defining the name of the default queue. Defaults to"default".#retries: A property indicating the number of retries for a job. Defaults to3.#expires: A property setting the expiration time for a job in seconds. Defaults to3.days.total_seconds.to_i.#timeout: A property indicating the timeout setting. Defaults to2.
Macro queue
queue(name, workers, kind): A macro for defining queues. It takes a queue name, the number of workers, and the kind of jobs the queue will handle. This macro creates and stores a newJoobQ::Queueinstance in the#queueshash.
Method #scheduler
#scheduler: A method that yields the singleton instance of theScheduler. This is useful for accessing the scheduler within the scope of theConfigurestruct.
Usage Example
To utilize the Configure struct for setting up queues, you can define them using the queue macro:
JoobQ::Configure.instance.queue "my_queue", 5, MyJob
This would create a new queue named "my_queue" with 5 workers that handle MyJob type jobs and store it in the
#queues hash.
Notes
- The
Configurestruct centralizes the configuration settings for theJoobQsystem, including Redis connection parameters and queue properties. - It uses environment variables for configuring the Redis client, providing flexibility and ease of configuration in different environments.
- The
queuemacro simplifies the process of setting up different types of queues, making theJoobQsystem adaptable to various job processing requirements.
Defined in:
joobq/configure.crMacro Summary
Instance Method Summary
- #dead_letter_ttl : Time::Span
- #dead_letter_ttl=(dead_letter_ttl : Time::Span)
- #default_queue : String
- #default_queue=(default_queue : String)
- #expires : Time::Span
- #expires=(expires : Time::Span)
- #failed_ttl : Time::Span
- #failed_ttl=(failed_ttl : Time::Span)
- #job_registry : JobSchemaRegistry
- #job_registry=(job_registry : JobSchemaRegistry)
- #queues : Hash(String, JoobQ::BaseQueue)
- #rest_api_enabled=(rest_api_enabled : Bool)
- #rest_api_enabled? : Bool
- #retries : Int32
- #retries=(retries : Int32)
- #scheduler(&)
- #stats_enabled=(stats_enabled : Bool)
- #stats_enabled? : Bool
- #store : Store
- #store=(store : Store)
- #timeout : Time::Span
- #timeout=(timeout : Time::Span)