Technical considerations
We made some opinionated choices on Thoth return types/
-
The java
CompletionStage
is used for async call but there is wrappers that exposesMono
for spring integration. -
The reactive stream
Publisher
is used for stream processing and akkaSource
and springFlux
can be used in modules. -
The vavr
Either
is used to handle business errors. The idea is to have three channels:- it’s ok:
CompletionStage(Right("Result"))
- it’s an error:
CompletionStage(Left("Bad request"))
- it’s a failure:
CompletionStage.failed(CrashedException("Crap!"))
- it’s ok:
-
io.vavr.Tuple0
is used instead ofvoid
so everything can be an expression:Tuple0 sideEffect() { println("I have done a side effect"); return Tuple.empty(); }