No commit activity in last 3 years
No release in over 3 years
ActiveJob::Query allows you query enqueued jobs and cancel jobs.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.10
~> 10.0

Runtime

 Project Readme

ActiveJob::Query

WARINING: This is alpha level release. Use it for testing only! (or if you want to contribute :) )

ActiveJob::Query is an wrapper around queueing adapter jobs query interface. It allows you to fetch jobs and manipulate the jobs.

Installation

Add this line to your application's Gemfile:

gem 'active_job-query'

And then execute:

$ bundle

Usage

Fetching all queues that the adapter is aware of

  # On the default adapter (ApplicationJob.queue_adapter or ActiveJob::Base.queue_adapter)
  ActiveJob::Query.queues
  # Or on a specific adapter
  ActiveJob::Query.queues(adapter: MyJob.queue_adapter)
  # or
  MyJob.queues

Working with queues

  # Get a queue
  queue = ActiveJob::Query.queues.first
  # Or initialize directly
  queue = ActiveJob::Query::Queue.new(name: "default", adapter: ActiveJob::Base.queue_adapter)
  # jobs count
  queue.size
  # clear jobs
  queue.delete_all
  # fetch jobs
  queue.jobs

Fetching jobs

  ActiveJob::Query.jobs(
    type: :all # allowed values: :all || :pending || :scheduled || :failed
    queue: "default", # queue name to search on
    adapter: AJ adapter defaults to ActiveJob::Base.queue_adapter
  )

Fetching all jobs on a specific queue

  ActiveJob::Query.queues[0].jobs

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/cristianbica/active_job-query.