The Kafka Client API provides two ways of processing records, using the handler and batchHandler methods.
It turns out that batchHandler cannot be used independently in the current implementation, since a call to handler (even if the function itself does nothing) is required in order for the batchHandler to be called.
The same issue in #170.
This fix changes the following:
null check on schedule now takes into account both handler types
to preserve the same guarantees provided for handler, the batchHandler reference is now captured in schedule and passed down to the run method.
the test for batchHandler no longer calls handler (verified that this makes the test time out without the actual fix)
The name multiHandler on the schedule method is not great but I didn't want to shadow the field name, I'm open to suggestions.
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.