Some time ago I have stopped writing posts for this blog, but it doesn’t mean that I have stopped learning new stuff! I actually switched to taking notes on my GitHub account. Each time I am investigating some topic, or just playing around with some technology, I push my code to GitHub together with explanations in a readme file of what’s going on. So here, let me share with you couple of the highlights of what’s been going on for some time now.
Composite UI Case Study
There are two flavours to the project: one for Spring and one for JEE. This is a simple investigation of how composite UI pattern (aka micro frontends pattern) can be applied to compose a single layout out of smaller components, each communicating with its own backend. I first heard about the idea from Udi Dahan. It is about vertical slicing of the domain, in which case each slice is responsible for the given aspect of the domain from the backend all the way to the frontend. Cool idea.
Kafka in Spring
This is a playground to investigate different ways Kafka messages can be consumed and produced in Spring applications. Couple of aspects covered in the project include:
- assigning a subscriber to a particular partition,
- stateless retries (handled on Spring side) vs stateful retries (relying on Kafka),
- pausing and resuming consumer,
- subscribing to a topic (requiring group.id),
- rebalancing of consumers handling particular partitions in case of misbehaving consumer,
- prosumer, consuming and producing within a single Kafka transaction (using KafkaTransactionManager),
- prosumer, consuming and producing to Kafka additionally writing to the database (Best Effort 1PC pattern),
- selected configuration parameters that allow control over different guarantees (ordering, exactly-once delivery, transactional processing).
For each scenario covered in the playground, there is a dedicated integration test, that demonstrates how it works in practice. Cool stuff, check it out!
Kafka Streams in Spring
This is a case study following the example presented in Designing Event-Driven Systems – Concepts and Patterns for Streaming Services with Apache Kafka by Ben Stopford (the book is free, and it’s available here). It’s about processing and joining streams of events. In this case it would be probably best if you check out the book and follow its examples. For a quick start though and a simplified scenario, my GitHub project might a quick reference point.
Enrichers in Completable Futures
This project is about difficulties related to reliable, concurrent modifications of a single object shared among multiple threads. What might seem simple, actually turns out quite hard. Long story short, when you are faced with a requirement to modify a single object concurrently, it could be a good idea to avoid it altogether. And this project is an attempt to showcase a pattern, in which state changes are collected concurrently, and then eventually applied to the object in the master thread.
Java Memory Model imposes couple of rules we should follow in order to reliably publish changes to our objects in multi-threaded context. You might want to google the terms of safe publishing and memory visibility. I also recommend studying Java Concurrency in Practice by Brian Goetz and others.
NrgyInvoicR – Energy Invoicing System
This project is a sample enterprise application that I showcase in my course. The backend of the project is a Spring application, and the frontend was created in Angular framework. Even though I created the project mostly for sake of the course, it might be still valuable to check out couple of patterns used in Spring and Angular applications. In the project, you will also find a system testing part, which covers most releavant end to end tests written in Selenium.
Be warned 😉 Self-promotion ahead!
By the way, if you are an aspiring software developer, you might want to check out the course here. Part of the course is the explanation of the business case covered by the project, as well as the demo of the running application. And the majority of lessons explain basics of technologies used in the system. The course also sets the project in the context of real-life company scenario, in which we need to also know software development lifecycle, Scrum, Clean Code principles, and all the supporting technologies, like version control systems, databases, network and infrastructure.
Mobile Case Study
This time, the domain of our interest is Mobile Network Operators (MNO) business. This project uses Flink, Kafka, Cassandra, and a Spring backend application to showcase a scenario of:
- importing raw data records as captured by network operator (periodically monitoring a folder in Flink),
- matching them with subscribers’ agreements (using Flink RichCoFlatMapFunction), and, once processed,
- storing in Cassandra database.
Additionally, one of the Flink jobs sets up a window operator (with a custom assigner, a custom trigger, and a process window function) that performs online monitoring of data consumed by the mobile phone of the network subscriber in order to pick up the moment at which data usage exceeds free data plan within the billing period. Such information can be used by MNO to cut off the data plan or switch to a lower network speed.
The project is configured to run locally in both Docker Compose and Kubernetes.
Enjoy!
And that’s it. I hope you find something interesting for you in these projects. Feel free to let me know your comments and questions. Thanks!