Deploy to local and remote Kubernetes cluster

In this blog post we look into how to setup the development environment when deploying to a Kubernetes cluster. We will use a simple Spring Boot service which we deploy to a local Kubernetes cluster (using Minikube) and also to a remote Kubernetes cluster (using GKE).

Read More

Running a multi-node Elasticsearch cluster locally with security enabled

In this blog I describe how you can run easily a multi-node Elasticsearch cluster with security enabled and access it with Kibana.

Note, that this setup is not for production. It is recommended to run only one node of Elasticsearch per server, but this setup is very useful for a development environment testing failover and different configurations.

Read More

Spring Cloud Config Retry

When having a microservices environment we must think of the resiliency of our environment when platform services like config-service, discovery-service are not available for a short period of time. Let’s consider a customer-service which uses discovery first bootstrap registering with a discovery-service and getting external configuration from the config-service. What we want is to be able to start the services in any order.

Read More

subscribeOn and publishOn operators in Reactor

Reactor does not enforce a concurrency model, it leaves that to the developer. By default the execution happens in the thread of the caller to subscribe(). Let’s consider the following method where we subscribe with 4 consumers to a Flux of Integers which print out the thread name while processing the emitted elements in the Flux.

public static void createSubscribers(Flux<Integer> flux) {
    IntStream.range(1, 5).forEach(value ->
        flux.subscribe(integer -> System.out.println(value + " consumer processed "
                + integer + " using thread: " + Thread.currentThread().getName())));
Read More

Setting up X-Pack Security

X-Pack is a group of plugins for Elasticsearch and Kibana which enhances the functionality of the Elastic Stack. We will focus in this blog post on the Security plugin but there are other plugins for Monitoring, Graph and Machine Learning.

Read More

Spring Cloud Services - Service Registry

Service registry is key component in a microservice architecture which allows applications to dynamically discover and call registered services instead of hand-configuring the used services. In this blog post we are going to look into Eureka and into Service Registry (which is based on Eureka) from Spring Cloud Services. Eureka comes from Netflix and has two components Eureka Server and Eureka Client. The Eureka Server can be embedded in a Spring Boot application using the @EnableEurekaServer annotation, but here we look into how to run it using the Spring Boot CLI with Spring Cloud CLI extension installed.
The spring cloud --list lists the available services which can be started

Read More

Spring Cloud Services - Config Server

Spring Cloud Config is a great tool to externalize configuration in a microservice architecture. It has server and client side support. In this blog post we are going to look into how to set up the server part locally and on Cloud Foundry and use it with a client application.

Read More

Spring Cloud Discovery with Spring Boot Admin

When registering services in the Spring Boot Admin dashboard there are two options:

  1. including the spring boot admin client dependency into the service
  2. or using Spring Cloud Discovery with a supported implementation (Eureka, Consul, Zookeeper)

I prefer using the Spring Cloud Discovery option because it feels more lightweight without including a dependency into the services and most of the time a Spring Cloud Discovery is already used for the services, why not leverage this one as well for Spring Boot Admin.

Read More

Install a specific version of a formula with homebrew

Installing software packages on Mac is very easy with homebrew. You typically get the latest version, however often in production you do not have the latest version of a software package. Another use case is when you upgrade to the latest and you find out there is bug which blocks you doing something. In this case you would like to downgrade to the previous version until the bug is fixed. In both cases you need to install a specific version of a software package with homebrew on your Mac, which tends to be not that trivial. There is a lot of discussion about this on stackoverflow but some of them are outdated based on brew versions which is not available anymore.

Read More

Streaming with Spring Cloud Data Flow

In this blog post I want to show how to create a “Hello World” streaming example using Spring Cloud Data Flow which simplifies the development and deployment of applications focused on data processing use-cases. Spring Cloud Data Flow originates from Spring XD which was a standalone project to build distributed data pipelines for real-time and batch processing.

Read More

Publishing domain events from aggregate roots

Starting with Spring Data Ingalls release publishing domain events by aggregate roots becomes easier. Instead of leveraging Spring’s ApplicationEventPublisher you can use @DomainEvents annotation on a method of your aggregate root. Let’s look at an example.

Read More

Centralized logging on AWS with Boxfuse

In a previous post we saw what steps we needed to do in order to configure a service running on multiple EC2 instances to use CloudWatch Logs as a centralized logging tool. In this post we will use Boxfuse to deploy our cloudwatch-logs-demo app and configure logging leveraging again CloudWatch Logs.

$ git clone
$ cd boxfuse-demo
$ mvn clean package
Read More

Centralized logging with CloudWatch Logs

In this blog post we will see how we can leverage Amazon CloudWatch Logs for centralized logging in Amazon AWS environment. A demo application is provided to see things in action. The plan is the following:

  1. deploy the application on an EC2 instance
  2. configure logging to send the log events to CloudWatch Logs service
  3. launch multiple ec2 instances running the demo application
  4. browse logs from multiple EC2 instances
Read More

AsyncRabbitTemplate with Spring Boot

Spring AMQP in version 1.6 introduced the AsyncRabbitTemplate which allows the caller of the send and receive operations (sendAndReceive, convertSendAndReceive) not to block. The caller instead gets a handle to the computation in progress in the form of a ListenableFuture or can handle the result in a callback via ListenableFutureCallback

Read More

Centralized configuration with Spring Cloud Config

In this blog post I am looking into Spring Cloud Config project which is a great tool for centralized configuration management in a microservice environment. I have prepared a simple example project which you can find on my github account. It contains a config-service leveraging Spring Cloud Config Server and three little services using Spring Cloud Config Client.

Read More

Docker App

In this blog post I would like to show you that the recently introduced Docker Native application (currently in private beta) makes it possible to configure a docker container with outside container storage without any workarounds on Mac or Windows, similarly how it works on Linux.

Read More

Application events with Spring

In this post I am looking into the awesome application event support provided by Spring Framework, which starting from version 4.2 got even better by introducing an annotation model to consume events, the possibility to publish any object as event not forcing to extend from ApplicationEvent.

Read More

SOAP over HTTPS with client certificate authentication

Recently I had to consume a SOAP web service over HTTPS using client certificate authentication. I thought I will write a blog post about it describing my findings. For the example I will build a simple service which exposes team information about the UEFA EURO 2016 football championship. The service will be secured with client certificate authentication and accessible only over HTTPS.

Read More