Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bytelegend/forestframework
https://github.com/bytelegend/forestframework
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/bytelegend/forestframework
- Owner: ByteLegend
- Created: 2021-07-18T10:51:27.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-06-29T23:16:55.000Z (over 2 years ago)
- Last Synced: 2023-03-05T01:15:57.652Z (almost 2 years ago)
- Language: Java
- Size: 1.61 MB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Forest Framework - a high-concurrency JVM web framework
## TLDR;
`Forest Framework` = `Vert.x` + `Guice`, with special support for Kotlin coroutines - "Code like sync, works like async", just like Loom.
Heads up: if you're not going to build an application for millions of concurrent users, go to [Spring Boot](https://spring.io/projects/spring-boot).
## Forest Framework is designed for high-concurrency
Without [Project Loom](https://openjdk.java.net/projects/loom/), we have only two options for JVM-based application:
- Synchronized application with heavy threads: easy to write, bad for performance.
- Async application with callback hell: much better performance, disastrous readability and maintainability.Forest Framework support Kotlin coroutines first workflow: you write suspend synchronized-like methods, then everything works in async way.
This is a Forest application example acting as a reverse proxy which redirects `github.com` to `localhost:8080`.
As you can see, we are writing sync code that works in non-blocking way - the code runs in `Vert.x` event loop thread and doesn't block at all.
And we avoid the usual callback hell in `Vert.x`!```
@ForestApplication
class App @Inject constructor(vertx: Vertx) {private val webClient = WebClient.create(vertx)
@GetHtml("/")
suspend fun index(): String {
return webClient.getAbs("https://github.com").send().await().bodyAsString()
}
}
```