You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+41-2
Original file line number
Diff line number
Diff line change
@@ -8,15 +8,16 @@ The Delayed Job adapter will be [removed from Rails soon](https://github.com/rai
8
8
9
9
If you are using a version of Rails that includes a Delayed Job adapter, using this gem will replace Rails' version with this gem's.
10
10
11
-
This gem implements some new features beyond what the Rails adapter did:
11
+
This gem implements some new features beyond what the Rails adapter did. See [features](#features) for instructions.
12
12
13
13
- Support for [`perform_all_later`](https://github.com/rails/rails/pull/46603).
14
-
- You can set `run_at`directly on a job instance.
14
+
- You can set `run_at`when bulk enqueueing.
15
15
- You can persist extra attributes on a job by writing to `job_attributes`.
16
16
17
17
---
18
18
19
19
-[Quick start](#quick-start)
20
+
-[Features](#features)
20
21
-[Support](#support)
21
22
-[License](#license)
22
23
-[Contribution guide](#contribution-guide)
@@ -34,6 +35,44 @@ Configure the Active Job backend. [See the Rails docs for more information](http
34
35
config.active_job.queue_adapter =:delayed_job
35
36
```
36
37
38
+
## Features
39
+
40
+
This gem supports all the base functionality of any Active Job adapter. So anything in https://guides.rubyonrails.org/active_job_basics.html should work. If it doesn't please log an issue.
Under the hood, this uses `Delayed::Job.insert_all` to insert all the jobs into the database using a single SQL query.
49
+
50
+
### Set `run_at` when bulk enqueueing
51
+
52
+
```ruby
53
+
job =HelloJob.new("Alex")
54
+
job.run_at =1.hour.from_now
55
+
ActiveJob.perform_all_later([job])
56
+
```
57
+
58
+
This is the equivalent to `HelloJob.set(wait: 1.hour).perform_later("Alex")`.
59
+
60
+
### Extra attributes via `job_attributes`
61
+
62
+
```ruby
63
+
job =HelloJob.new("Alex")
64
+
job.job_attributes = { metadata:"foo" }
65
+
job.enqueue
66
+
```
67
+
68
+
```ruby
69
+
job =HelloJob.new("Alex")
70
+
job.job_attributes = { metadata:"foo" }
71
+
ActiveJob.perform_all_later([job])
72
+
```
73
+
74
+
These examples would write `"foo"` into the `metadata` column on the `delayed_jobs` table. This works with any type of column, not just strings.
75
+
37
76
## Support
38
77
39
78
If you want to report a bug, or have ideas, feedback or questions about the gem, [let me know via GitHub issues](https://github.com/TandaHQ/delayed_job-active_job/issues/new) and I will do my best to provide a helpful answer. Happy hacking!
0 commit comments