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
BatchProcessorinterface to handle your specific jobs. - New instance of the
MicroBatchcan 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
MicroBatchcan be started with theyourMicroBatch.Start(c), where c - is acontext.Context,context.Contextis used for signalling whenMicroBatchneeds to stop (so usecontext.WithCancel). - New running instance of the
MicroBatchcan be created with theNewRunning(c, yourBatchProcessor). - New job can be submitted to the
MicroBatchviayourMicroBatch.Submit(yourJob). - A job is an instance of the
Jobtype. - Implement
BatchStorageto supply your own custom storage viaStorageoption.
See CHANGELOG.md
See CONTRIBUTING.md
Released under the Apache License 2.0.