How to really utilize asynchronous events

Meet Kalium, a reactive Java framework for microservices

Jane Elizabeth
Shutterstock / mirzamlk

Have you taken your vitamins today? While Kalium probably won’t help stave off a bout of scurvy, it certainly will perk up your code. Kalium is a reactive framework designed for Java and Apache Spark.

Quick – what’s the atomic element number 19? It’s been a while since chemistry class, but potassium does a lot of heavy lifting in your everyday life. Today, we’re giving your code a boost with Kalium, a reactive framework for Java and Apache Spark.

Kalium is a neo-Latin word for potassium, a soft, silvery-white metal that is chemically reactive. (And, frankly, kind of explosive. Don’t add it to water.) It’s a helpful addition to the microservices ecosystem, making it simpler for asynchronous microservices to interact.

Developers can use Kalium to help manage their asynchronous data flows. But how does it work? This framework utilizes existing queue technology as a scalable event bus.

Event-driven architecture is mainly about delivering and processing events asynchronously. Kalium uses Apache Kafka as the underlying event bus, which promises a ‘guaranteed and ordered delivery’.

Essentially, Kalium uses the @On annotations to define out out-of-the-box serializer/de-serializer for the event classes. The condition that is specified inside the @On annotation is then translated into a generated queue listener based on the underlying queue that it uses.

So, what kind of use cases does this framework support? The basic example is for online shopping. Kalium creates reactive microservices that help navigate the issues of payments and receipts. So, once a customer gets to the checkout page, they send a payment. When the payment is processed, the reactive framework needs to ensure a receipt is sent.

Currently, Kalium supports Java. However, further implementations are planned, including support for languages like JavaScript, Python, and AWS Kinesis.

SEE MORE: How to save your microservices project from a macro fail

Getting Kalium

Trying out Kalium is about as easy as heading to your local pharmacy and picking up a bottle of vitamins. Kalium’s Maven group ID is io.alkal and its artifact ID is kalium-kafka.

Kalium is an open source project and relies on contributions from developers like you. Head on over to GitHub for questions, comments, and compliments.

Jane Elizabeth
Jane Elizabeth is an assistant editor for

Inline Feedbacks
View all comments