This story focuses on Authorizing the API calls with AWS SIGV4 on spring boot applications. This is primarily a use case when we setup AWS API Gateway with IAM Authorizer.
How to do it?
We will use AWS Request Signing interceptor. Basically we use AWS core sdk dependency and customize HTTP Client to make external calls. In the same way we will configure RestTemplate with custom http client to create AWS SIGV4 for every outbound call.
We should include following dependency in our project.
Let us do it in simple Java method first
In this article, we’re going to look at the new Spring Cloud Bus project. Spring Cloud Bus uses lightweight message broker to link distributed system nodes. The primary usage is to broadcast configuration changes or other management information. We can think about it as a distributed Actuator.
The project uses Kafka broker as the transport, but Active MQ or Redis can be utilized instead of Kafka. Other transports are not supported yet.
Before moving forward please look at the spring config server setup that I already documented here. …
This story talks about the encrypting secure data like (passwords, API Keys of third party information ..) at REST when spring cloud config is used as centralized configuration for micro services.
Please read the following blog to get started with Spring cloud config server.
The Config Server can use a symmetric (shared) key or an asymmetric one (RSA key pair). In this story we use both the ways.
For Spring Cloud to be able to encrypt and decrypt properties you will need to add the full-strength JCE to your JVM (it is not included by default). You can download the “Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files” from Oracle and follow the installation instructions. …
This story focuses on composite configuration in spring cloud config with backend as Jdbc (Postgres), Redis and S3. When I am implementing this I didn’t find enough details available on internet with Redis, JDBC and S3. But a lot are available on GIT as backend. So I am not going to talk about GIT here.
High level information about Spring cloud config server
The idea is that our program or programs can move your settings to an external place so that our application is easily configurable and can even change their settings.
This is widely used in microservices. A same service or application can be launched many times in different containers, and it is interesting to have a central place where they can read the settings to these services. …
This story talks about performance of Spring Rest API vs gRPC service implementation. We will use the Apache benchmark to perform a performance test on exhaustive load.
gRPC is an RPC implementation/framework from Google for inter-microservices communication. Google has been using this for more than 15 years (the internal name is Stubby). It is battle tested for more than a decade. Google site shows they have been processing 10 BILLIONS requests / second using gRPC.
We will see why gRPC is faster than REST with a simple. Before that Let see the basic difference between Rest and RPC
GRPC brings in many advantages in using HTTP2 protocol. Please see for the details. …
This article talks about master-slave configuration set up in local docker setup and we will verify read replica of slave nodes when master is unavailable or down. We can read data of not when the master node is down. This sample is explained with Spring Boot.
In realtime, the application has to process and fetch from multiple tables through joining to get complex data every time. To improve performance, if we could cache the response which does not change frequently, so that performance will be faster.
When cache is implemented there will be a 100% probability that a single instance can be hit with maximum load on a single instance. For Ex: an app service or back-end system continuously sends requests to a single instance then there might be chances where the connections in Redis instance may be exhausted. …
This story I will talk about, how to process real time data streaming using redis streams in spring boot. This will be explained with producer and consumer model.
Earlier, I tried Redis pub/sub model. But it has a problem when producer publishes to topic, all its consumers will process the data unlike Kafka uses consumer group. Pubsub doesn’t work that way — the message goes to all connected subscribed clients
Previously the real time processing is done in different way. For Ex : when payments were made we will save in database and later in night or in multiple batches we process the data and gets reflected in to system with new data offline. …
This articletalks about handling the scheduled tasks in Spring boot applications when deployed in multi-node environments. Talks about solutions how to handle such situations.
When Spring scheduler is scheduled to run every one hour if it is deployed in multi nodes, the scheduler triggers on both the nodes. This is expected as each node is a separate service altogether.
In my earlier assignments, we use to have a separate microservice that has only scheduled tasks with no other functionalities and it is deployed as a single node on a global region. …
This story focusses on new addition about customising your git with fancy badges, connect with me icons, dynamically include your blogs sourcing from the parent website, include your youtube channel videos and update changes, your git stats, your git recent activity and you could include the song that you are listening in spotify. Awesome isn’t it? Let’s go over how to do it.
Please find snapshot of my git profile currently
As a first step all you have to do is create a repository with your username. As my username is ereshzealous. I have created the repo with that name.
I am working on one of my projects where Postgres happens to be the relational database and has a big table, currently had 10 Million records and can bloat up more. The challenge we have is wildcard search is becoming costly and takes more time to fetch results.
I would like to demonstrate with a sample database and data in it.
CREATE TABLE user_details (
id BIGSERIAL PRIMARY KEY,
user_uuid UUID NOT NULL,
first_name TEXT NOT NULL,
last_name TEXT NOT NULL,
email_id TEXT NOT NULL,
security_number TEXT NOT NULL,
phone_number TEXT NOT NULL,
created_at TIMESTAMP NULL DEFAULT now(),
updated_at TIMESTAMP NULL DEFAULT now()…