JDriven Blog

How to get an ActorContext from Akka testKit

Posted on by  
Tammo Sminia

In Akka Typed we need an ActorContext to create new actors.

This poses some problems if we want to create an actor inside a class that’s not an actor. We can pass around an ActorContext from a (higher level) actor. But if this is a longer-lived class, we have to keep in mind that this ActorContext is only valid during construction. So it’s generally frowned upon to pass around the ActorContext.

Continue reading →

Setting up Azure Devops Pipelines for your Kotlin projects

Posted on by  
Alexander Chatzizacharias

Azure DevOps seems to be getting quite popular. All .NET projects I have worked on last couple of years use it, which is quite understandable since it is made and maintained by Microsoft. But also in the world of Java/Kotlin, Azure DevOps is becoming an excellent choice. Maybe Microsoft loves Java after all! A DevOps service isn’t a DevOps service without some solid CI/CD tooling. Azure DevOps’s CI/CD tooling is called Azure Pipelines. So how do you set up an Azure Pipeline for your Kotlin project? Fortunately, its quite simple.

Continue reading →

Smart constructors in Kotlin

Posted on by  
Ties van de Ven

Making illegal states unrepresentable is a good engineering practice. To do this we want to add checks before object creation to make sure it is created in a correct state. Throwing exceptions in the constructor would work for this but it would mean introducing runtime exceptions in your software. If you want to safely create objects without runtime exceptions then smart constructors might be a good solution for you.

Continue reading →

Optics in Kotlin with Arrow

Posted on by  
Ties van de Ven

Immutability is a good practice with a lot of advantages. One of the disadvantages however is that it is hard to make changes in deeply nested immutable data structures. To circumvent this, Optics were invented and the Arrow library brings these to Kotlin.

Continue reading →

Major migrations made easy with OpenRewrite

Posted on by  
Tim te Beek

OpenRewrite enables large-scale distributed source code refactoring for framework migrations, vulnerability patches, and API migrations with an early focus on the Java language.

— Introduction to OpenRewrite
https://docs.openrewrite.org

To demonstrate OpenRewrite, this blogpost will walk through upgrading a Spring Boot 1.5 application to 2.5+. Along the way we will pick up JUnit 5, and migrate from Java 8 to 17, with minimal manual intervention.

We’ll start with the Spring PetClinic Sample Application, back as it was almost five years ago in 2017!

Continue reading →

Let's talk functions

Posted on by  
Jacob van Lingen

Cologne. Anno Domini 1470. For over two hundred years German craftsmen have been working on the cathedral close the Rhine. At the very moment, master Tilman is busy decorating one of the pillars in the left center of the nave. He has done this profession for his entire live. His hands carve a figure from a grey stone. First the baby Jesus emerges. Then a head, a body and finally the feet of a man come into view. It is the saint Christopher. According to legend, together with the divine child this saint carries the burden of the entire world. It is a marvel to watch the skilled worker chisel a man from rock. And yet, if you watch him closely, you start to wonder if he really has to use his old tools. Wouldn’t he do his job even better with new shiny gear? Does the veteran artisan really know all the tricks, or could even he learn something new?

Continue reading →

Fault Tolerance in Quarkus

Posted on by  
Justus Brugman

Yet another short post using Quarkus. Quarkus is a full-stack, Kubernetes-native Java framework, but for this short post I’m using Kotlin for a change. The goal of this post is to show you how easy it is to use the circuit-breaker pattern to build fault tolerant services. For this we use the smallrye-fault-tolerance library, an implementation of the Eclipse MicroProfile Fault Tolerance.

Continue reading →

DataWeave Delight: Wrapping string values

Posted on by  
Hubert Klein Ikkink

If we want to wrap a string value with another string value we can use the wrapWith and wrapIfMissing functions defined in the dw::core::Strings module. The first argument of these functions is the string we want to wrap and the second argument is the string value that wraps the first argument. The function wrapIfMissing will only apply the wrapper string if it was not already applied.

To remove a wrapped character from a wrapped string we can use the unwrap function. The first argument is the string value that is already wrapped and the second argument the character we want to use for unwrapping. The second argument can only be a single character, but we can repeatedly invoke the unwrap function to remove multiple wrap characters.

Continue reading →

shadow-left