Create a new IterableQueueMapper, which uses IterableMapper underneath, and exposes a
queue interface for adding items that are not exposed via an iterator.
Function called for every enqueued item. Returns a Promise or value.
IterableQueueMapper options
Private _iterablePrivate _sourceGenerated using TypeDoc
Accepts queue items via
enqueueand calls themapperon them with specifiedconcurrency, storing themapperresult in a queue ofmaxUnreadsize, before being iterated / read by the caller. Theenqueuemethod will block if the queue is full, until an item is read.Remarks
Typical Use Case
concurrency: 1) case, allows 1 item to be flushed async while caller prepares next itemIterableQueueMapperSimple)maxUnreadis reachedError Handling
The mapper should ideally handle all errors internally to enable error handling closest to where they occur. However, if errors do escape the mapper:
When
stopOnMapperErroris true (default):AsyncIterator's next() callWhen
stopOnMapperErroris false:AggregateErrorafter all items completeUsage
await enqueue()methodawait enqueue()method will block until a slot is available, if queue is fulldone()when no more items will be enqueuedawait onIdle()to ensure all items are processedSee
IterableMapper for underlying mapper implementation and examples of combined usage