README.md in phobos-1.8.2.pre.beta2 vs README.md in phobos-1.8.2
- old
+ new
@@ -215,11 +215,11 @@
`.start` -> `#consume` -> `.stop`
or optionally,
`.start` -> `#before_consume` -> `#around_consume` [ `#consume` ] -> `.stop`
-
+
#### Batch Consumption
In addition to the regular handler, Phobos provides a `BatchHandler`. The
basic ideas are identical, except that instead of being passed a single message
at a time, the `BatchHandler` is passed a batch of messages. All methods
@@ -233,27 +233,27 @@
assumes that you are still processing the messages one at a time and should
use `Handler`.
```ruby
class MyBatchHandler
- includes Phobos::BatchHandler
-
+ include Phobos::BatchHandler
+
def before_consume_batch(payloads, metadata)
payloads.each do |p|
p.payload[:timestamp] = Time.zone.now
end
end
-
+
def around_consume_batch(payloads, metadata)
yield
end
-
+
def consume_batch(payloads, metadata)
payloads.each do |p|
logger.info("Got payload #{p.payload}, #{p.partition}, #{p.offset}, #{p.key}, #{p.payload[:timestamp]}")
end
end
-
+
end
```
Note that retry logic will happen on the *batch* level in this case. If you are
processing messages individually and an error happens in the middle, Phobos's