Micro-batching is a subset of the batch processing, which is aimed to improve latencies of the long batch processing tasks. It is sort of a middle ground in-between the conventional batch processing (which handles batches of a big size and takes long time for results to be available) and the streaming (or stream processing) where inputs aren't aggregated in the batches and everything is handled as it appears. The goal is to reduce latency and still to allow for reasonable throughput.
So the microbatch is a aimed to provide simple primitive for adopting micro-batch technic inside your projects.
- You'd need to implement
BatchProcessor
interface to handle your specific jobs. - New instance of the
MicroBatch
can be created with theNew(yourBatchProcessor, options...)
, options are used for customising configuration (seeOption
). - Available options:
Limit
- limits the size of the batch,Cycle
- sets max time window for next batch processing,Storage
- allows to provide custom storage for submitted batches. - Created instance of the
MicroBatch
can be started with theyourMicroBatch.Start(c)
, where c - is acontext.Context
,context.Context
is used for signalling whenMicroBatch
needs to stop (so usecontext.WithCancel
). - New running instance of the
MicroBatch
can be created with theNewRunning(c, yourBatchProcessor)
. - New job can be submitted to the
MicroBatch
viayourMicroBatch.Submit(yourJob)
. - A job is an instance of the
Job
type. - Implement
BatchStorage
to supply your own custom storage viaStorage
option.
See CHANGELOG.md
See CONTRIBUTING.md
Released under the Apache License 2.0.