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 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