Skip to content

Commit

Permalink
other example
Browse files Browse the repository at this point in the history
  • Loading branch information
mperham committed Jan 21, 2015
1 parent 959561e commit f074cce
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion Pro-2.0-Upgrade.md
Expand Up @@ -7,7 +7,9 @@ smoothly.

## Nested Batches

Batches can now be nested within the `jobs` method for more complex job workflows.
Batches can now be nested within the `jobs` method.
This feature enables Sidekiq Pro to handle workflow processing of any size
and complexity!

```ruby
a = Sidekiq::Batch.new
Expand All @@ -27,6 +29,25 @@ Parent batch callbacks are not processed until any child batch callbacks have
run successfully. In the example above, `MyCallback` will always fire
before `SomeCallback` because `b` is considered a child of `a`.

Of course you can dynamically add child batches while a batch job is executing.

```ruby
def perform(*args)
do_something(args)

if more_work?
# Sidekiq::Worker#batch returns the Batch this job is part of.
batch.jobs do
b = Sidekiq::Batch.new
b.on(:success, MyCallback)
b.jobs do
OtherWork.perform_async
end
end
end
end
```

## Batch Data

The batch data model was overhauled. Batch data should take
Expand Down

0 comments on commit f074cce

Please sign in to comment.