Sql or NoSql, that’s the question

Although it’s undeniable that most applications developed over the years have SQL as storage solution, it is nowadays common to face the choice, before starting developing a new one, between SQL or NoSQL persistence.
Both solutions have pros and cons and sometimes one is far better than others. Let me give you, through a real case, what’s my point of view in this article.
Continue reading “Sql or NoSql, that’s the question”

Combining cloneable interface with Memento Pattern

Clonable interface and Memento pattern: what do they have in common? At first glance, I’d say nothing, the first is a JDK interface while the last is a programming language pattern, yet, once bind togheter, they could give us a powerful tool to apply in our solution.
Continue reading “Combining cloneable interface with Memento Pattern”

Can Ci/Cd get on with databases?

While it’s easy to apply Ci/Cd to stateless components such an application or job, the things become more complicated when we try applying the same method to statefull infrastructure as database or message broker.
Although changes in statefull components are less frequently than in stateless one, we shouldn’t give up to cover this deployment stage with a pipeline, probably we need a multi steps approach to sort it out.
Continue reading “Can Ci/Cd get on with databases?”

Why is Java moving to Functional Programming ?

Functional Programming (FP) has been introduced in JDK since version 8 with JSR 335 (Lambda Expressions for the Java Programming Language). Frameworks as Spring and others have been changing their implementation in the new releases.
In this article I tried to understand why we should care about this programming approach.

Continue reading “Why is Java moving to Functional Programming ?”

Apache Kafka and Rabbit – Dealing with Stream

Very often I come accross article about Stream processing in Message Broker (Apache Kafka, RabbitMq, …) where it seems that the difference between a traditional and Stream message processing depends on the message numbers producing/consuming rate.
If I’m going to have a large number of messages, I call it Stream processing, otherwise, it’s a traditional way to handle them.
Definitely, message throughput matter, but is that the only point to keep in mind when you’re going to build an event consumer?
Continue reading “Apache Kafka and Rabbit – Dealing with Stream”

RESTFul Api – Response status and operation result

Giving back a meaningful http status code and message to a client when it invokes our RESTFul service is a correct and desirable behaviour expected by our consumers.

It’s not enough including the information result in the return message to complete our task. This information must be wrapped inside a correct response status and a suitable message.

Continue reading “RESTFul Api – Response status and operation result”

Reactive or Asynchronous? Trying Avoid any headache choice

Is it better to use Spring Webflux project, with its Reactive API, or Asyncronous support for calling a method in separates thread?
Performance, resource consumption, how many factors should I consider when I write my code and call an external resource that could block my method execution waiting for an answer?

It’s interesting to see the difference before making any choice.
Continue reading “Reactive or Asynchronous? Trying Avoid any headache choice”

Goodbye RestTemplate – let’s welcome WebClient Interface

RestTemplate has been declared “deprecated” since Spring Framework version 5.2.2.
WebClient is its announced substitute and brings the reactive approach at runtime.
So, this means not a simple “find & replace” might be enough, sometimes a code refactory is expected to move from imperative to functionals programming model.
Let’s see what this means with some examples.
Continue reading “Goodbye RestTemplate – let’s welcome WebClient Interface”

Make API predictable – HTTP Response Status Codes

Make Api predictable is a best practice that helps developers to keep code maintainable and avoid bugs. In the same way, Clients can use them without unexpected behaviours or pitfalls.

Give back a correct HTTP status based on action outcome and message produced, it’s a good behaviour to avoid misunderstanding with Client.

In this article I’ll illustrate what I’m talking about.

Continue reading “Make API predictable – HTTP Response Status Codes”

How Logstash can carry your logs for you

Logstash is a very useful tool to help you carry logs from your application inside a search engine as ElasticSearch for Log aggregations.
Once logs imported, you could analize them by using a visual dashboard as Kibana or Grafana. Let’s see how to bring them together through a brief example.
Continue reading “How Logstash can carry your logs for you”