Open sourcing Thoth

larousso
OSS by MAIF
Published in
2 min readMar 8, 2021

La version Française de cet article est disponible ici.

Today we open Thoth, our Java library which offers a toolkit to implement event sourcing in your Java application.

Power your Java Apps with Event Sourcing

Rather than maintaining an up-to-date application state, event sourcing focuses on what happened by storing events.

This approach provides by-design audit log for the application.

It is also very well suited for event-driven architectures : events can be published as is.

It plays well with CQRS : building and maintaining read projections is done by consuming events.

Thoth guaranties that:

  • Events will be written in the database before being published in Kafka (to prevent failure)
  • Publication in Kafka will be reattempted until it succeeds

It provides capabilities of defining two types of projections :

  • “Real time” projections, that are updated in the same transaction as the events
  • “Eventually consistent” projections, updated asynchronously by consuming Kafka

More information is available here : https://github.com/maif/thoth

You can also find demos here : https://github.com/MAIF/thoth/tree/master/demo

The other good news is Thoth comes with 3 other Java libraries which you may use with Thoth or independantly :

Jooq Async

Jooq Async allows you to use Jooq, Vertx Postgresql client and Vavr together. With this lib, you can build queries with the power of Jooq and run it on a small thread pool using Vertx.

More info here : https://github.com/MAIF/jooq-async

Functional Json

Functional Json helps you to manipulate JSON in a functional way.

It provides flowless helpers to write / read Jackson node, and elegant error handling.

More info here : https://github.com/MAIF/functional-json

Functional Validation

Functional Validation allows you to define atomic validation and compose them. At the end, you will have a successful validation or all the errors that have been collected.

You may also use Bean Validation JavaEE specification (JSR 303) and combine it with manual validation.

More info here : https://github.com/MAIF/functional-validation

Event sourcing powers a lots of our application. We hope Thoth will fit your needs and that you will enjoy it !

--

--