The Chunks transform component splits incoming messages into smaller chunks based on a maximum size or idle time.
class Chunk extends Transform {
fixed sourceName = "chunks"
maxChunkSize: UInt32
maxIdleTime: Duration
}
Attribute | Type | Description | Default Value |
---|---|---|---|
maxChunkSize |
UInt32 |
The maximum number of messages to include in each chunk. | Required |
maxIdleTime |
Duration |
The maximum idle time before creating a chunk with fewer than maxChunkSize . |
Required |
- Input Type:
any
- Output Type:
chan any
new Transforms.Chunk {
name = "example-chunks"
maxChunkSize = 50
maxIdleTime = 1.s
}
The Chunks transform component breaks down a continuous stream of messages into smaller, manageable chunks. Chunks are created either when the maximum number of messages (maxChunkSize
) is reached or when the stream remains idle for a specified duration (maxIdleTime
).
- Stream Segmentation
- Split a continuous data stream into smaller, manageable parts for downstream processing.
- Rate Control
- Use
maxIdleTime
to ensure timely chunk delivery even when the stream has low activity.
- Use
- Configure both
maxChunkSize
andmaxIdleTime
to balance performance and latency. - The choice of
maxChunkSize
andmaxIdleTime
should align with the requirements of downstream components.