ABatchNode
Base class for any batch (fan-out) node. Use it for splitting a collection or iterating a paginated upstream.
import ABatchNode from '@orchesty/nodejs-sdk/dist/lib/Batch/ABatchNode';
Inheritance #
ANode -> ABatchNode
Methods you implement #
| Method | Returns | Purpose |
|---|---|---|
getName() | string | Stable internal node identifier. |
processAction(dto) | Promise<BatchProcessDto> | Emit zero or more items via dto.addItem*(). Optionally set a cursor to be re-invoked. |
Output methods (on BatchProcessDto) #
| Method | Effect |
|---|---|
addItem(payload) | Emit one downstream message. |
addItemFromArray(payload) | Same as above, typed for plain objects. |
setItemList(items) | Convenience for "shred this array into N messages". |
setItemList(items, true) | Wrap the array as a single message. |
setBatchCursor(cursor) | Iterate again with the new cursor. Items already emitted flow downstream in parallel. |
setBatchCursor(cursor, true) | Iterate again, but hold items until pagination completes (aggregation). |