Rest Api is the most popular interface for exchanging data between platforms and OpenApi specifications make very easier for everyone to publish and consume any Rest Api.
Tools, as Swagger, let generate code for both client and server avoid us all the “boilerplate code” to connect with the services or expose them. Yet, all that glitters is not gold, let’s see why..
Continue reading “Why Swagger code generator doesn’t fit for me”
Category: Spring
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”
RabbitMQ – Observability and Monitoring
Looking inside an application to understand how it’s going and what, potentially, is wrong is a “must have” when you’re drawing a solution.
RabbitMQ is not an exception at this requirement thus, we need in some way, to expose metrics and collects them for any monitoring tool.
Let’s see how to achieve this goal.
Continue reading “RabbitMQ – Observability and Monitoring”
GraphQL, when less is more
GraphQL has improved the Rest Api’s capability to exchange data between different systems. Client is able to ask only the data it requires, avoiding useless data and improving the performance by saving the data throughtput.
So, we’re ready to say goodbye to traditional Rest Api?
Continue reading “GraphQL, when less is more”
Spring Cloud Gateway inside Kubernetes
One of the first things you learn when you approached microservices architecture is not a good idea to make all services visible to external client. Thus, you need something, as a Gateway, to put between your services and the world.
in this article, I’ll show you how to configureSpring Cloud Gateway (SCP) in Kubernetes in order to give a single entry point to the external clients.
Continue reading “Spring Cloud Gateway inside Kubernetes”