KeyedBatchCoordinator
class KeyedBatchCoordinator<T : Any, K : Any>(val name: String, val options: BatchOptions, val laneCount: Int, keySelector: (T) -> K, writer: BatchWriter<T>) : GracefullyStoppable
Partitions submissions into a fixed number of serial batch lanes.
Equal ordering keys are assigned to the same lane. Batch writer invocations inside one lane are serial, while different lanes may invoke writer concurrently. The coordinator keeps one global admission bound and one lifecycle across all lanes.
Multiple items with the same key may be included in one native batch. This type does not impose an item execution order inside a protocol-specific batch; a writer that requires such an order must provide it.
When laneCount is greater than one, keySelector runs during lazy submission and must be deterministic and non-blocking. A selector failure rejects only that submission. Ordering keys must obey the usual equality/hash-code contract.
Constructors
Link copied to clipboard
constructor(name: String, options: BatchOptions, laneCount: Int, keySelector: (T) -> K, writer: BatchWriter<T>)