Blog

Collection of curated blog posts from me.

Spring Cloud Config, Spring Cloud Bus & Kafka - How to set up automatic updates of your configuration

Introduction In this article, I will show you how to achieve automatic updates with Spring Cloud Bus and Kafka The Spring Cloud Bus, according to documentation: Spring Cloud Bus links nodes of a distributed system with a lightweight message broker. This can then broadcast state changes (e.g., configuration changes) or other management instructions. AMQP and Kafka broker implementations are included in the project. Alternatively, any Spring Cloud Stream binder on the classpath will work out of the box as a transport.

Read more →

December 21, 2023

Spring Boot Mutation testing with JUnit5, Testcontainers, and Pit

What is mutation testing? Mutation testing is a type of testing that validates new and existing tests. More formal definition from Wikipedia: Mutation testing (or mutation analysis or program mutation) is used to design new software tests and evaluate the quality of existing software tests. Why do we need mutation testing? The problem that solves mutation testing is checking the validity of the existing and new tests. I often have met invalid unit tests that have covered only the happy path and no other paths.

Read more →

December 13, 2023

Digital Image Processing Basics

Introduction Digital image processing is the acquisition, analysis, and performing of a wide range of operations on an image. In digital image processing, there are three types of images: Binary Grayscale RGB The digital image can be represented within the two-dimensional array. A binary image is represented by a dimensional array where each cell stores 0 (black) and 1 (white) values. A grayscale image is a two-dimensional array where values in the array lay in a range from 0 to 255

Read more →

November 26, 2023

Write your Spring Boot (3.x) starter with Kotlin & Maven

Some companies use Camunda(TM) BPMN Engine for managing the business automatization process. Most of the functionality provided out of the box is enough for most cases. But recently I have realized that we have always written our service to send messages to the engine. So, I decided to write my starter. The native language for Camunda is Java, but it supports many other languages. Since I want programming experience in Java, I have decided to write my starter with Kotlin. For those who are already tired — the full code is available on the GitHub There are no breaking backward capability changes in writing spring boot starters.

Read more →

January 23, 2023

Spring Boot interaction with Kafka with HTTPS

In this article, we will be developing a Spring Boot application that works with Kafka and terminates traffic via HTTPS. So first of all we have to generate self-signed certificates by following the bash script. #!/bin/bash set -o nounset \ -o errexit \ -o verbose \ -o xtrace # Generate CA key openssl req -new -x509 -keyout snakeoil-ca-1.key -out snakeoil-ca-1.crt -days 365 -subj ‘/CN=localhost/OU=TEST/O=MEDIUM/L=PaloAlto/S=Ca/C=US’ -passin pass:medium -passout pass:medium # openssl req -new -x509 -keyout snakeoil-ca-2.key -out snakeoil-ca-2.crt -days 365 -subj ‘/CN=ca2.test.confluent.io/OU=TEST/O=MEDIUM/L=PaloAlto/S=Ca/C=US’ -passin pass:meduim -passout pass:medium # Kafkacat openssl genrsa -des3 -passout “pass:medmium” -out kafkacat.client.key 1024 openssl req -passin “pass:medium” -passout “pass:medium” -key kafkacat.client.key -new -out kafkacat.client.req -subj ‘/CN=localhost/OU=TEST/O=MEDIUM/L=PaloAlto/S=Ca/C=US’ openssl x509 -req -CA snakeoil-ca-1.crt -CAkey snakeoil-ca-1.key -in kafkacat.client.req -out kafkacat-ca1-signed.pem -days 9999 -CAcreateserial -passin “pass:medium” for i in broker1 consumer # we are going to generate certs for broker(zookeper) and cosumer(our app) do echo $i # Create keystores keytool -genkey -noprompt \ -alias $i \ -dname “CN=localhost, OU=TEST, O=MEDIUM, L=PaloAlto, S=Ca, C=US” \ -keystore kafka.$i.keystore.jks \ -keyalg RSA \ -storepass confluent \ -keypass confluent # Create CSR, sign the key and import back into keystore keytool -keystore kafka.$i.keystore.jks -alias $i -certreq -file $i.csr -storepass confluent -keypass medium openssl x509 -req -CA snakeoil-ca-1.crt -CAkey snakeoil-ca-1.key -in $i.csr -out $i-ca1-signed.crt -days 9999 -CAcreateserial -passin pass:medium keytool -keystore kafka.$i.keystore.jks -alias CARoot -import -file snakeoil-ca-1.crt -storepass meduim -keypass medium keytool -keystore kafka.$i.keystore.jks -alias $i -import -file $i-ca1-signed.crt -storepass medium -keypass medium # Create truststore and import the CA cert. keytool -keystore kafka.$i.truststore.jks -alias CARoot -import -file snakeoil-ca-1.crt -storepass medium -keypass medium echo “medium” > ${i}_sslkey_creds echo “medium” > ${i}_keystore_creds echo “medium” > ${i}_truststore_creds done This script eventually generated for us following files

Read more →

January 22, 2023

HashiCorp Vault - Getting started

Hi, there! It is a text version of the Vault webinar Let’s go! First of all, we have to download Vault or install it via your favorite packet manager. You can download the latest version of Vault from the official website — https://www.vaultproject.io/downloads Or simply install it via brew brew tap hashicorp/tap brew install hashicorp/tap/vault After successful installation, we can check that Vault in the PATH

Read more →

February 23, 2022

Stop writing code inside main method

Introduction Greetings to everyone who reads this post! Due to my work, I often run into novice programmers and look at their code. Sometimes it is beautiful, sometimes not, but I understand that a person learns, and the further he masters the best practices and technologies, the better his code becomes. But I would still like to pay some attention to such a simple task that almost all novice programmers face — writing a calculator.

Read more →

November 29, 2020

Software architecture, 2

My previous blogpost start from the house picture — as analogy about architecture. But I found some problems with this analogy: There is no software construction industry in the same degree that there is for buildings. The building industry has substantial substructure, reflection numerous specialisations, skill sets, training paths, corporate organisations, standards bodies, and regulations. While the software industry has some structure, including that seen in offshore development practices, it is much less differentiated than the building industry The discipline off architecture does not have anything akin to the issue of deployment in software: Software is built in one place, but deployed for use in many places, often with specialisation and localisation. Manufactured building, otherwise known as trailers, are somewhat similar, but still there is no corresponding notion to dynamic distributed, mobile architectures, as there is with software Software is a machine; building are not (notwithstanding Le Corbusier’s declaration that, “A house is machine for living in”). The dynamic character of software — the observation that led to Edsger Dijkstra’s famous “goto statement considers harmful” paper (Dijkstra 1968), provides a profoundly difficult challenge to designers, for which there is not counterpart in building design Fundamental understanding There are three fundamental understandings of architecture, the recognition of which helps situate architecture with respect to rest of software engineering:

Read more →

November 28, 2020

Software architecture

Introduction In this article I will try to explain what is architecture, clean architecture, architector role in project Examples of web architecture application Let’s consider an example of a service with one architectural level (Single Tier) In an application with one architectural level, the user interface, business logic, that is, the backend part of the application and the database are on the same server An example of an application with one architectural level are applications such as MS Office, GIMP

Read more →

November 24, 2020