Closed danielbcorreia closed 7 months ago
can you add a test for this ?
can you add a test for this ?
hey @vietj , there was testConsumerBatchHandler
already, but it was calling handler
(thus bypassing the issue) - I fixed that as well.
do you mind having a look @ppatierno ?
@ppatierno @vietj can this be merged in? I recently ran into this issue as well.
@danielbcorreia can you provide a backport PR for the 4.x branch ?
Motivation:
The Kafka Client API provides two ways of processing records, using the
handler
andbatchHandler
methods. It turns out thatbatchHandler
cannot be used independently in the current implementation, since a call tohandler
(even if the function itself does nothing) is required in order for thebatchHandler
to be called.The same issue in #170.
This fix changes the following:
schedule
now takes into account both handler typeshandler
, thebatchHandler
reference is now captured inschedule
and passed down to therun
method.batchHandler
no longer callshandler
(verified that this makes the test time out without the actual fix)The name
multiHandler
on theschedule
method is not great but I didn't want to shadow the field name, I'm open to suggestions.