Java

Writing better Spring applications using SpringFu

Writing better Spring applications using SpringFu

“Truth can only be found in one place: the code,” Robert C. Martin, Clean Code: A Handbook of Agile Software Craftsmanship.

The way we structure our code has a direct impact on how understandable is it. Code that is easy to follow with no or less hidden functionality is much easier to maintain. It also makes it easier for our fellow programmers to track down bugs in the code. This helps us to avoid Venkat’s Jesus Driven Development.

The way I write Spring applications comprises heavy use of Spring annotations. The problem with this approach is that partial flow of the application is controlled by annotations. The complete flow of my code is not in one place, that is, in my code. I need to look back to the documentation to understand the annotations’ behavior. By reading just the code, it is difficult to predict the flow of control.

Luckily, Spring has a new way to code to and it has been called Spring Functional or SpringFu. In this article, I will use Kotlin to showcase some of the benefits you get from SpringFu.

Continue reading “Writing better Spring applications using SpringFu”

Share
Processing CloudEvents with Eclipse Vert.x

Processing CloudEvents with Eclipse Vert.x

Our connected world is full of events that are triggered or received by different software services. One of the big issues is that event publishers tend to describe events differently and in ways that are mostly incompatible with each other.

To address this, the Serverless Working Group from the Cloud Native Computing Foundation (CNCF) recently announced version 0.2 of the CloudEvents specification. The specification aims to describe event data in a common, standardized way. To some degree, a CloudEvent is an abstract envelope with some specified attributes that describe a concrete event and its data.

Working with CloudEvents is simple. This article shows how to use the powerful JVM toolkit provided by Vert.x to either generate or receive and process CloudEvents.

Continue reading “Processing CloudEvents with Eclipse Vert.x”

Share
Demystifying the Red Hat Decision Manager and Process Automation Manager Remote Client

Demystifying the Red Hat Decision Manager and Process Automation Manager Remote Client

KIE-Server is the light-weight, cloud-native, rules and process execution runtime of the Red Hat Decision Manager (RHDM) and Red Hat Process Automation Manager (RHPAM) platforms. Lately, I’ve gotten more and more questions on how to use the KIE-Server Client Java API to interact with the KIE-Server execution runtime of RHDM (formerly called Red Hat JBoss BRMS) and RHPAM (RHPAM). To answers these questions, and to create a future reference, I decided to write a number of code examples, accompanied by this article.

The KIE-Server Client Java API provides an easy way for Java applications to communicate with the KIE-Server execution engine of RHDM and RHPAM. The API abstracts the application from the underlying REST and/or JMS communication protocol and transport, making integrations with the server easier to build, test, and maintain.

Continue reading “Demystifying the Red Hat Decision Manager and Process Automation Manager Remote Client”

Share
How to install Java 8 and 11 on Red Hat Enterprise Linux 8 Beta

How to install Java 8 and 11 on Red Hat Enterprise Linux 8 Beta

With Red Hat Enterprise Linux (RHEL) 8 Beta, two major versions of Java will be supported: Java 8 and Java 11. In this article, I’ll refer to Java 8 as JDK (Java Development Kit) 8 since we are focusing on the development aspect of using Java. JDK 8 and JDK 11 refer to Red Hat builds of OpenJDK 8 and OpenJDK 11 respectively. Through this article, you’ll learn how to install and run simple Java applications on RHEL 8 Beta, how to switch between two parallel installed major JDK versions via alternatives and how to select one of the two JDKs on a per-application basis.

Continue reading “How to install Java 8 and 11 on Red Hat Enterprise Linux 8 Beta”

Share
Quickly try Red Hat Process Automation Manager in your cloud

Quickly try Red Hat Process Automation Manager in your cloud

It’s been some time since I last talked with you about putting JBoss BPM Suite (now called Red Hat Process Automation Manager) into your cloud, and with the new release, it’s time to talk AppDev in the cloud again.

It’s time to update the story and see how to put Red Hat Process Automation Manager in your cloud so you are set up with a standard configuration to start your first business rules project.

With the easy installation demo project described below, you can leverage process automation tooling through the business central web console running containerized on any Red Hat OpenShift.

Let’s take a closer look at how this works.

Continue reading “Quickly try Red Hat Process Automation Manager in your cloud”

Share
How Kotlin’s coroutines improve code readability

How Kotlin’s coroutines improve code readability

Programs must be written for people to read, and only incidentally for machines to execute. — Abelson and Sussman

Kotlin is a new practical language designed to solve real-world problems. It is based on JVM but there are many differences between Kotlin and Java. Kotlin is a null-safe and concise language with support for functional programming. You can try programming in Kotlin here.

Kotlin coroutines provide an easy way to write highly scalable code, using the traditional style of programming, while avoiding having a thread allocated to each task.

In this article, I focus on code readability and how, in my opinion, coroutines provide a cleaner approach to writing code compared to a reactive approach. I have used Project Reactor to showcase the reactive code; however, the example can be extended to any reactive library, for example, RxJava and CompleteableFuture. Note that coroutine-based code scales as well as code written using a reactive approach. To me, coroutines are a win-win situation for developers.

Continue reading “How Kotlin’s coroutines improve code readability”

Share
Extending support to Spring Boot for Red Hat OpenShift Application Runtimes

Extending support to Spring Boot for Red Hat OpenShift Application Runtimes

What Red Hat is providing

Red Hat OpenShift Application Runtimes (RHOAR) is a recommended set of products, tools, and components for developing and maintaining cloud-native applications on the Red Hat OpenShift platform. As part of this offering, Red Hat is extending its support to Spring Boot and related frameworks for building modern, production-grade, Java-based cloud-native applications.

Spring Boot lets you create opinionated Spring-based standalone applications. The Spring Boot runtime also integrates with the OpenShift platform, allowing your services to externalize their configuration, implement health checks, provide resiliency and failover, and much more. To learn more about how Spring Boot applications integrate with the wider Red Hat portfolio, check out the following OpenShift Commons Briefing by Thomas Qvarnstrom:

Continue reading “Extending support to Spring Boot for Red Hat OpenShift Application Runtimes”

Share
Eclipse MicroProfile for Spring Boot developers

Eclipse MicroProfile for Spring Boot developers

By now you have probably heard of Eclipse MicroProfile (MP). It is a community-driven initiative to define specifications for enterprise Java microservices. MicroProfile is only two years old, yet it has delivered eight innovative specifications and is evolving fast. It provides metrics, API documentation, health checks, fault tolerance, distributed tracing, and more. With it, you can take full advantage of cutting-edge cloud-native technologies and do it in a vendor-neutral fashion!

For developers familiar with Spring Boot, we have prepared this article, which compares the basics of developing applications with Spring Boot and with MicroProfile. We wrote two applications, one with each solution. In this article, we will go through the differences between them. You can find the source code for both projects on GitHub.

For the MicroProfile application, we use Thorntail (formerly know as Wildfly Swarm), but except for the setting up part, Open Liberty, Payara, TomEE, or any other implementation would look exactly the same.

Throughout this article, we assume you know Spring Boot and we focus on what is different in MicroProfile.

Continue reading “Eclipse MicroProfile for Spring Boot developers”

Share
Quickly try Red Hat Decision Manager in your Cloud

Quickly try Red Hat Decision Manager in your Cloud

It’s been some time since I last talked with you about business logic engines and using them in application development cloud architectures. At that time, I showcased running JBoss BRMS in a container on Red Hat OpenShift. This gives you the cloud experience, one that’s portable across private and public clouds, but on your own local laptop using Red Hat Container Development Kit.

The world continues to move forward, a new product has been released which replaced JBoss BRMS with the Red Hat Decision Manager, so now I want to provide a way for you to install this on OpenShift, in the same easy to use demo format.

Continue reading “Quickly try Red Hat Decision Manager in your Cloud”

Share