Asynchronous terminal sink — calls a callback on receiving data.
Capabilities: isInput, isAsyncPushable
Mechanics:
The constructor accepts config.callback: AsyncDataHandler
asyncPush(data) — calls await callback(data)
destroy() — inherited from BaseStateTransfer, clears _state
Ordered execution (config.ordered: true):
When enabled, callback invocations are executed sequentially in
data-arrival order, regardless of their async duration.
Uses an internal OrderedExecutor (promise chain).
Default: false (unordered, backward-compatible).
Error handling:
If callback() throws an exception, onError is called.
With onError provided, the exception is suppressed. Without onError — rethrown.
When ordered: true, the executor chain catches errors so that a throwing
callback does not block subsequent callbacks. The error is still propagated
to the asyncPush caller via the awaited executor promise.
Configuration (AsyncSinkTransferConfig):
callback: AsyncDataHandler — incoming data handler (sync or async)
Asynchronous terminal sink — calls a callback on receiving data.
Capabilities: isInput, isAsyncPushable
Mechanics:
Ordered execution (config.ordered: true):
Error handling:
Configuration (AsyncSinkTransferConfig):
Use cases: