Introduction

In this article, we will look at how we can write AWS infrastructure as code using the Cloud Development Kit. This feature may appeal to those who prefer a programmatic approach to infra code.

What is CDK?

CDK can be considered as an alternative to other infra-code tools such as cloud formation(though CDK still generates cloud formation in the background) and terraform(within the context of AWS as terraform can be used for hybrid cloud workloads). It is open-sourced by AWS and, as of today, supports the following programming languages: TypeScript, JavaScript, Java, C# and Python.

At its core CDK lets us define reusable…


Introduction

Developing asynchronous, non-blocking and reactive applications in Java has never been easier thanks to Spring WebFlux. In this article, we will discuss what is the difference between regular Java web app frameworks(for example Spring Web MVC) and reactive based frameworks like Spring WebFlux.

Request handling in Spring MVC

First, let’s understand how input requests are handled in a typical Spring web MVC application. Whenever an input request arrives, the web server — tomcat for example — assigns a servlet thread to handle the request like below.

As we can see servlet/container/request threads get blocked waiting for the database/external service I/O to be completed(I/O doesn’t require…


While developing microservices, sometimes in monolithic apps as well, there is a need to save data to the database and call another service or messaging platform with some more information. What if these two operations need to be atomic? Meaning if the first call to the database is successful, the second call must be successful as well — at least eventually.

Sometimes, people write code like below to send a message to the second service:

dbClient.save(data);

var retries = 5;

while(retries !== 0) {
try{
//call another service/messagr broker
serviceClient.send(data);
break;
}catch(err){
tries -= 1;
}
}

The issue with…


While developing microservices, sometimes in monolithic apps as well, there is a need to save data to the database and call another service or messaging platform with some more information. What if these two operations need to be atomic? Meaning if the first call to the database is successful, the second call must be successful as well — at least eventually.

Sometimes, people write code like below to send a message to the second service:

dbClient.save(data);

var retries = 5;

while(retries !== 0) {
try{
//call another service/messagr broker
serviceClient.send(data);
break;
}catch(err){
tries -= 1;
}
}

The issue with…


In this article we look at how to do database migrations using TypeORM and NestJS. For people who don’t know these frameworks: NestJS is an opinionated server-side application development framework built on top of Node.js; TypeORM is an ORM framework like Hibernate and can be used with Typescript and Javascript. This combination has become quite popular nowadays for building back-end apps. Developers who have experience in Angular, SpringBoot would almost feel home when building apps with these frameworks.

First, lets create a scaffolding for our NestJS app with the following commands:

1.git clone https://github.com/nestjs/typescript-starter.git nestjs-typeorm-migration-demo2.cd nestjs-typeorm-migration-demo3.npm install4.npm…

Java has introduced one of its most awaited features in version 9: modules. In this article we will briefly look at how this feature can help us in modularising Java applications.

Before Java9 we could group application code using classes, packages and JARs. At class level, information could be hidden using access modifiers - though you could use reflections to break this - but there was little encapsulation at package and JAR level. For example, if classes needed to be shared across packages then we were forced to make them public: there by creating a chance of unintended usage. In…


Styling components in React using CSS modules

React has several ways to style components. In this tutorial we will look at one of those approaches: css modules. If you like writing css in separate files yet scoping it to particular components then this technique could help. For this tutorial let’s use create-react-app version 3.4.0. Historically we needed to eject create-react-app configuration to enable css modules but since CRA version 2.x.x, we wouldn’t need to that any more.

Now let’s create a react app with the following command: npx create-react-app cssmodules-demo. To demonstrate I have created a simple button on the…

Anjith Paila

engineer

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