The coolest thing I’ve written in Kotlin so far…

The coolest thing I’ve written in Kotlin so far…

Wrote a reactive transaction manager for Spring so I can make transactions across multiple repositories inside a service and not just be tied to making a transaction only on one repository like what

ReactiveTransactionManager

restricts you to. Very useful if a lot of your business logic goes in the service layer:

The gist:

https://preview.redd.it/nhma09798j061.png?width=863&format=png&auto=webp&s=2379f93230ecf7612270d5abba65e15266736cf5

The implementation:

https://preview.redd.it/bz3hzrm48j061.png?width=1169&format=png&auto=webp&s=482af17a342542f85a39bec4737e5b651e32a7fb

The usage: (not the best use case, but at least it fits in one screenshot; it can be used across multiple repositories too)

https://preview.redd.it/yw4duqui7j061.png?width=1171&format=png&auto=webp&s=07f9960cc3248b9acaf99d6d16f4e7e7dea5e942

The usecases may be small, but damn that shitcode was fun to write

submitted by /u/wtf_kyle
[link] [comments]