Spring Mysql R2DBC Example

Vikas Ve2ma
Introduction You can find the details about R2DBC from the official site of spring and R2DBC. What is R2DBC? R2DBC stands for Reactive Relational Database Connectivity, a specification to integrate SQL databases using reactive drivers. Spring Data R2DBC applies familiar Spring abstractions and repository support for R2DBC. –Spring Data R2DBC The official site for R2DBC is here Versions and Dependencies org.springframework.boot:2.5.6 org.projectlombok:lombok:1.18.22 org.springframework.boot:spring-boot-starter-data-r2dbc:2.5.6 org.springframework.boot:spring-boot-starter-webflux:2.5.6 dev.miku:r2dbc-mysql:0.8.2.RELEASE mysql:mysql-connector-java:8.0.27 Maven Repositories - https://oss.

Multitenancy using Spring data JPA and hibernate

Vikas Ve2ma
Introduction What is multitenancy You can see the definition of the multitenancy from the wiki. As it says - Software multitenancy is a software architecture in which a single instance of software runs on a server and serves multiple tenants. Systems designed in such manner are “shared” (rather than “dedicated” or “isolated”). A tenant is a group of users who share a common access with specific privileges to the software instance.

Message Gateway

Vikas Ve2ma
Message Gateway Introductions A gateway is an interface that provides two-way communication between APIs and endpoints. It provides a simple interface that interacts with the business logic. The API does not that it interacting with the spring integration. Type of Gateways Synchronous gateway In synchronous gateway, the sender thread suspended until a reply is received or a timeout happens. After spring integration 4.3, a new asynchronous gateway was added to the spring gateway.

Message channels and Adapters

Vikas Ve2ma
Message Channel A message channel is use to transport the message from one messaging endpoint to another. It integrate the messaging endpoints. Message channel used to decouple the message producer and consumer. There are 3 interface provided for message - 1. Message Channel Interface It is the base interface they provide two methods to send the messages public interface MessageChannel { boolean send(Message message); boolean send(Message message, long timeout); } The return value true means message sent successful.

What are the Message Endpoints?

Vikas Ve2ma
MessageEndpiont Message endpoints connect the application to the messaging framework in a non-invasive manner. The application would not have any idea or details of the message usage. Transformer A transformer will consume the message and transform the message into another message. The transformer can change the content or structure of the message. It can also change the header or remove the header information. Filter The message filter determines whether a message should be pass to an output channel or not.

What is Message, in Spring Integration

Vikas Ve2ma
What is Message Message content the actual data and its metadata, that need to pass to other services. The message is having 2 parts Header The header contains the metadata about the message like Payload It contains the data that needs to pass in the message. It consists of a payload and headers. The payload is actual data of any type. The headers can contain information such as correlation Id, timestamp, and return address.

Ratelimiter With Resilience4j Spring Boot2

Vikas Ve2ma
Introduction Rate limiting is technique to help to limit the number of requests or type of request received by a server. It help to scale and increase the reliability of the system. As per resilience4j doc Rate limiting is an imperative technique to prepare your API for scale and establish high availability and reliability of your service. But also, this technique comes with a whole bunch of different options of how to handle a detected limits surplus, or what type of requests you want to limit.

Spring Reactive Transaction With Mongo

Vikas Ve2ma
Introduction In this blog post we will use ReactiveMongoTransactionManager class to manage the transaction. Along with that we shall use the mongo db. Version Kotlin: 1.3.71 Spring-boot: 2.2.6.RELEASEA Java: 11 mongo db: 4.2.0-rc2-bionic Dependencies You can use Spring Initializer to initialize the project you need following dependencies - Spring Reactive Web Spring Data Reactive MongoDB Create docker-compose.yml file I use docker for running the mongo db the docker compose file looks like this -

Spring Boot Resilience4j Circuitbreaker Annotation Example

Vikas Ve2ma
Introduction This is continuation of my previous blog on Resilience4j. In this blog, we shall try to use the annotation and external configuration for the circuit breaker implementation. So let’s start by creating a basic application. Our application would have one controller and one service class. We already saw how to make the reactive basic application in a previous blog. Now we will continue from that. Version Details spring-boot:2.

Spring boot reactive and resilience4j circuit breaker example

Vikas Ve2ma
Introduction Resilience4j is a lightweight, easy-to-use fault tolerance library inspired by Netflix Hystrix, but designed for Java 8 and functional programming. Lightweight, because the library only uses Vavr, which does not have any other external library dependencies. Resilience4j provides higher-order functions (decorators) to enhance any functional interface, lambda expression or method reference with a Circuit Breaker, Rate Limiter, Retry or Bulkhead. You can stack more than one decorator on any functional interface, lambda expression or method reference.