Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cristianbica/active_job-query
ActiveJob Query API
https://github.com/cristianbica/active_job-query
Last synced: 20 days ago
JSON representation
ActiveJob Query API
- Host: GitHub
- URL: https://github.com/cristianbica/active_job-query
- Owner: cristianbica
- Created: 2015-08-16T22:37:59.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-04-29T19:37:54.000Z (over 3 years ago)
- Last Synced: 2024-10-16T02:18:18.938Z (about 1 month ago)
- Language: Ruby
- Size: 17.6 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this 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:
```ruby
gem 'active_job-query'
```And then execute:
$ bundle
## Usage
Fetching all queues that the adapter is aware of
```ruby
# 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
```ruby
# 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
```ruby
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
```ruby
ActiveJob::Query.queues[0].jobs
```## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/cristianbica/active_job-query.