https://github.com/mechero/java-9-flow-reactive
A sample application using Java 9's Flow API and SubmissionPublisher
https://github.com/mechero/java-9-flow-reactive
flow java java9 reactive-programming
Last synced: 6 months ago
JSON representation
A sample application using Java 9's Flow API and SubmissionPublisher
- Host: GitHub
- URL: https://github.com/mechero/java-9-flow-reactive
- Owner: mechero
- Created: 2018-01-29T05:51:07.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-01T05:39:21.000Z (almost 8 years ago)
- Last Synced: 2025-04-30T18:33:05.087Z (8 months ago)
- Topics: flow, java, java9, reactive-programming
- Language: Java
- Size: 51.8 KB
- Stars: 35
- Watchers: 1
- Forks: 15
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Java 9 Flow Example - TPD.io

## Description
This is a simple project that shows how to use Java 9's Flow API to create a Reactive Programming example. It's based on a story: a Magazine Publisher with two different Subscribers, one of them being too slow to pick items.
The guide [Reactive Programming with Java 9 Flow](https://thepracticaldeveloper.com/2018/01/31/reactive-programming-java-9-flow/) explains this code and the fictional use case with detail.
## Code Structure
* `ReactiveFlowApp` creates a Publisher using Java 9's `SubmissionPublisher`. It implements backpressure and dropping of items by setting a timeout for subscribers.
* `MagazineSubscriber` implements `Flow.Subscriber` and let you experiment what happens when subscribers are slow.
* `ColorConsoleAppender` has nothing to do with Java 9 or reactive programming, is just a utility class to set colors to log messages so the result can be understood easier.
## Feedback and Contribution
If you find something wrong, feel free to create an issue. Same if you have questions. If you want to help me creating more code examples you can [buy me a coffee](https://www.buymeacoffee.com/ZyLJNUR).