Skip to content

streams: parallel execution of independent sources with ordered output#428

Open
cportele wants to merge 1 commit into
masterfrom
reactive-concurrent-flatmap
Open

streams: parallel execution of independent sources with ordered output#428
cportele wants to merge 1 commit into
masterfrom
reactive-concurrent-flatmap

Conversation

@cportele

Copy link
Copy Markdown
Contributor

Add two operators that let independent inner sources run concurrently without changing the order of the emitted items:

  • Transformer.flatMapConcurrent(fn, maxConcurrency, prefetch): subscribes up to maxConcurrency mapped inner sources at once while emitting their items in the original order (concatMapEager).
  • Source.guarded(acquire, release, inner): runs acquire on subscribe and release on termination on a worker thread, so a blocking acquire (e.g. taking permits from a semaphore that bounds resource use) does not block the subscribing thread.

Add two operators that let independent inner sources run concurrently
without changing the order of the emitted items:

- Transformer.flatMapConcurrent(fn, maxConcurrency, prefetch): subscribes up to
  maxConcurrency mapped inner sources at once while emitting their items in the
  original order (concatMapEager).
- Source.guarded(acquire, release, inner): runs acquire on subscribe and release
  on termination on a worker thread, so a blocking acquire (e.g. taking permits
  from a semaphore that bounds resource use) does not block the subscribing
  thread.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant