@@ -179,6 +179,8 @@ def paused?(topic, partition)
179
179
# @param min_bytes [Integer] the minimum number of bytes to read before
180
180
# returning messages from each broker; if `max_wait_time` is reached, this
181
181
# is ignored.
182
+ # @param max_bytes [Integer] the maximum number of bytes to read before
183
+ # returning messages from each broker.
182
184
# @param max_wait_time [Integer, Float] the maximum duration of time to wait before
183
185
# returning messages from each broker, in seconds.
184
186
# @param automatically_mark_as_processed [Boolean] whether to automatically
@@ -190,10 +192,11 @@ def paused?(topic, partition)
190
192
# The original exception will be returned by calling `#cause` on the
191
193
# {Kafka::ProcessingError} instance.
192
194
# @return [nil]
193
- def each_message ( min_bytes : 1 , max_wait_time : 1 , automatically_mark_as_processed : true )
195
+ def each_message ( min_bytes : 1 , max_bytes : 10485760 , max_wait_time : 1 , automatically_mark_as_processed : true )
194
196
consumer_loop do
195
197
batches = fetch_batches (
196
198
min_bytes : min_bytes ,
199
+ max_bytes : max_bytes ,
197
200
max_wait_time : max_wait_time ,
198
201
automatically_mark_as_processed : automatically_mark_as_processed
199
202
)
@@ -253,6 +256,8 @@ def each_message(min_bytes: 1, max_wait_time: 1, automatically_mark_as_processed
253
256
# @param min_bytes [Integer] the minimum number of bytes to read before
254
257
# returning messages from each broker; if `max_wait_time` is reached, this
255
258
# is ignored.
259
+ # @param max_bytes [Integer] the maximum number of bytes to read before
260
+ # returning messages from each broker.
256
261
# @param max_wait_time [Integer, Float] the maximum duration of time to wait before
257
262
# returning messages from each broker, in seconds.
258
263
# @param automatically_mark_as_processed [Boolean] whether to automatically
@@ -261,10 +266,11 @@ def each_message(min_bytes: 1, max_wait_time: 1, automatically_mark_as_processed
261
266
# messages can be committed to Kafka.
262
267
# @yieldparam batch [Kafka::FetchedBatch] a message batch fetched from Kafka.
263
268
# @return [nil]
264
- def each_batch ( min_bytes : 1 , max_wait_time : 1 , automatically_mark_as_processed : true )
269
+ def each_batch ( min_bytes : 1 , max_bytes : 10485760 , max_wait_time : 1 , automatically_mark_as_processed : true )
265
270
consumer_loop do
266
271
batches = fetch_batches (
267
272
min_bytes : min_bytes ,
273
+ max_bytes : max_bytes ,
268
274
max_wait_time : max_wait_time ,
269
275
automatically_mark_as_processed : automatically_mark_as_processed
270
276
)
@@ -400,7 +406,7 @@ def join_group
400
406
end
401
407
end
402
408
403
- def fetch_batches ( min_bytes :, max_wait_time :, automatically_mark_as_processed :)
409
+ def fetch_batches ( min_bytes :, max_bytes : , max_wait_time :, automatically_mark_as_processed :)
404
410
join_group unless @group . member?
405
411
406
412
subscribed_partitions = @group . subscribed_partitions
@@ -411,6 +417,7 @@ def fetch_batches(min_bytes:, max_wait_time:, automatically_mark_as_processed:)
411
417
cluster : @cluster ,
412
418
logger : @logger ,
413
419
min_bytes : min_bytes ,
420
+ max_bytes : max_bytes ,
414
421
max_wait_time : max_wait_time ,
415
422
)
416
423
0 commit comments