The MicroBatcher is a Go library for grouping individual tasks into smaller batches.
- Go - developed with Go 1.22.1
The examples below describe a basic set-up to start working with the library.
go get github.com/peoxia/microbatcher
microbatcher, err := New(batchProcessor, batchSize, batchIntervalMs, batchProcessorTimeout)
if err != nil
return err
}
jobResultCh := microbatcher.JobResults()
go func() {
for {
jobResult, ok := <-jobResultCh
if !ok {
return
}
// Process job result
}
}()
microbatcher.ListenAndProcess()
microbatcher.SubmitJob(Job)
microbatcher.Shutdown()