Skip to content

Commit

Permalink
doc: add example with arguments to `each_iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
fwolfst committed May 13, 2022
1 parent 2b17a3a commit 424cd40
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,24 @@ class CsvJob < ApplicationJob
end
```

```ruby
class AdditionalArgumentsJob < ApplicationJob
include JobIteration::Iteration

def build_enumerator(message, name, age, cursor:)
enumerator_builder.active_record_on_records(
User.where(name: name, age: age),
cursor: cursor,
)
end

# addtional arguments as in #build_enumerator (except the cursor)
def each_iteration(user, message, *)
user.notify_about_something(message)
end
end
```

Iteration hooks into Sidekiq and Resque out of the box to support graceful interruption. No extra configuration is required.

## Guides
Expand Down

0 comments on commit 424cd40

Please sign in to comment.