technical

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

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

Spring+kotlin+mongo+testcontainer

Vikas Ve2ma
Introduction In this project we shall see how to use testcontainer to test the repository created in mongodb As per their document Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container. Prerequisit Docker Create sample project Go to the spring initializer and create project with language as kotlin and dependencies required are webflux & reactive mongo db

Add swagger to the kotlin spring

Vikas Ve2ma
Introduction In this short article we shall see how to configure swagger with spring webflux project. We create a project on spring initializer and then shall configure swagger. Dependencies Create a project on the spring boot initializer page with dependency as ‘webflux’ and language as ‘java’ In order to work swagger with kotlin you need to add the following repositories in you pom.xml file. Since the swagger dependencyis available in another repository you need to add that repository as well in you ‘pom.

Scala Mongo example with akka-http and akka-stream

Vikas Ve2ma
Introduction In this tutorial we shall create and CRUD web application in Scala. We will use MongoDB Scala Driver to communicate to the mongo database. It is officially supported Scala driver for MongoDB. Along with that we shall create a Rest API using akka-http module and akka-streams. Prerequisites Scala version: 2.13.1 Database: Mongo:3.4.23-xenial Other dependencies About the service/project Application should be able to do CRUD operations on the in mongodb document.

Scala Rest API with akka-http

Vikas Ve2ma
Introduction In this tutorial we shall explore how we can use akka-http to create service with scala. Here we create CRUD service with akka actor and try to see how it work. Versions Scala version: 2.13.1 SBT version: 1.3.4 Other dependencies About the service/project We’ll create two actors that communicate with each other to get the user data and user activity data. Data Classes We need two data classes that keeps the user data and user activity data.