reactive-streams-jvm: Document if Publisher.subscribe is allowed to block
Hi,
I’m using reactive-streams and wrote a Publisher for ZeroMq.
One of the first things is stumbled over was, if the method Publisher.subscribe(...) must return and emit the results async, or if the method can block.
I looked up the javadoc of the method, but it isn’t documented. Would be great to make a statement what is expected by that method.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 21 (18 by maintainers)
Oops, I accidentally pressed the lovely “Close and comment”.
@guenhter Please read the spec in full: that example code violates many of the Reactive Streams rules, including not respecting back-pressure.
If creating a certain Socket is a blocking operation, then it would be prudent to not create the Socket in
.subscribe()but defer it to another thread (pool). The idea of Reactive Streams is to have Publisher and Subscriber use different resources, especially threads.