In my previous article, I showed simple CRUD operation with Reactive Spring. If you haven’t checked it out, then you can check it out here.

Image for post
Image for post
https://spring.io/reactive

In this article, I’ll be covering how API calls can be made with reactive spring framework. I’ll use my project in previous article in which I created apis to perform CRUD operations as a server and we’ll build a client for it to call those APIs.

Project Setup


Image for post
Image for post
https://www.postgresql.org/
  • What — Partitioning is splitting one table into multiple smaller tables.
  • When — It is useful when we have a large table and some columns are frequently occurring inWHEREclause when we the table is queried. Let’s suppose Book table in library management system, so here inventory of books can be huge and will always be increasing. But, the general queries over the Book table will basically be about the book status (borrowed/not borrowed or available/not available). Here, we observe that most queries on book table would be on attribute status. …


In the previous article, we went through basics of circuit breaker, discussed about its state cycle, now let’s head towards building a simple circuit breaker.

In this article, we’ll learn about:

  • how to record success/failures
  • how to switch between CLOSE and OPEN state (skipping HALF_OPEN for this article)
  • how to compute current state of circuit breaker (compute based on last ’n’ number of requests, where n represents the window size for recording the results processed requests through circuit breaker)

Let’s begin with planning the interface for circuit breaker and decide which methods need to be exposed.

Circuit Breaker Interface

public interface CircuitBreaker {…


The closest circuit breaker that we can relate to in our daily lives is MCB, which is present in every home to protect devices from electrical circuit failures which could lead to increased flow of current beyond a specific capacity. It achieves protection from high in-flow of current by disrupting or opening the circuit to stop the flow.

Let’s consider we have microservices A,B and C. Assume that A calls B and B further calls C. Now, if at any point of time, if C experiences some issues (like CPU usage is high, or service is down) due to which…


After covering basics of partitioning, let’s move on to some advanced partitioning concepts.

If you haven’t read the first part, then you may want to read it first Partitioning with PostgreSQL v11

In this article, I’ll cover the following topics:

  1. Sub partitioning (Partition of Partitions)
  2. Attaching/Detaching Partition

I’ll use process_partition table from previous article, with an added attribute:created_year.

Image for post
Image for post
Partitioning structure based on status

Above structure shows, process_partition is the master table and it has 3 partitions, namely, process_partition_open, process_partition_in_progress and process_partition_done, which are partitioned based on the values of status attribute which can be OPEN, IN_PROGRESS and DONE.

As we start using the system, which…


Today we’ll learn about connecting to SQL (Relational) databases with reactive repositories with spring boot. In this project i’ll be using

  • Spring boot 2.3.0.RELEASE
  • PostgreSQL for database

Project Setup

Image for post
Image for post
https://start.spring.io/

application.properties

spring.r2dbc.url=r2dbc:pool:postgresql://localhost:6432/r2dbc
spring.r2dbc.username=username
spring.r2dbc.password=password

Creating Entity

import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
@Table
public class Employee {

@Id
private Long id;

private String name;

private String department;

}

SQL Code for creating employee table

CREATE TABLE employee(
id bigserial NOT NULL,
name character varying(255) ,
department character varying(255) ,
CONSTRAINT pk_emp_id PRIMARY KEY (id)
);

Notice that, annotation @Id comes from spring data and not from java persistence when we use spring data jpa. Also, we have used…

Rishi Sharma

Software Engineer || Coviam Technologies https://www.linkedin.com/in/rishi1997/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store