Skip to main content

Posts

Showing posts with the label microservice

Microservices with Spring Boot - complete tutorial

In this tutorial we are going to learn how to develop microservices using spring boot with examples. Main focus of this tutorial is on learning by doing hands-on. Before hands-on we will first understand what is microservices and related terminologies like DDD, 12-Factors App, Dev Ops. What is a Microservice In simple terms microservice is a piece of software which has a single responsibility and can be developed, tested & deployed independently. In microservices we focus on developing independent and single fully functioning modules. Opposite to microservice, with monolithic application it focuses on all the functionality or modules in a single application. So when any changes required to monolithic application it has to deploy and test the complete application while with microservice it has to develop and deploy only affected component which is a small service. It saves lot of development and deployment time in a large application. It's basically an architectural style ...

Microservices - Spring cloud API gateway along with registry server

Here we will learn, how to create API gateway using Spring cloud API. We will also register it with discovery/ registry server. Also will see how to access microservice using registry server through API gateway. What is API gateway As its name implies, API gateway is the single entry-point to an application or system. It can handle a request and invoke the appropriate service registered with it. It provides many features like protocol translation, filtering, security, interceptors etc. Using API gateway we can invoke any microservice whether its direct invocation or using some registry/ discovery server to invoke registered services using their ID. Creating API gateway In our example we will create an API gateway which will register itself with Eureka discovery server and will invoke the microservice available in discovery server using its registered service ID. API gateway can be implemented two ways, one is using Zuul proxy and second is using spring cloud API gateway. Differ...

Microservices - Service Registration/ discovery using Spring boot and Eureka

In this tutorial we will learn how to create registry/ discovery server using Eureka and Spring boot. We will register our Rest microservice with this registry server which can be discovered by client by connecting to registry server. What is registry/ discovery server We can assume registry or discovery server as a central place where we can find all our microservices using their registered IDs with discovery server. Microservices register themselves in registry server and client applications access them using a single registry or discovery server. It is similar to a phone directory but provides many other useful features. If we don't user registry server then we need host name and endpoint details to access a service. In today's era most of the services are deployed in cloud and using cloud features like auto-scaling where network addresses are updated dynamically and we can't use a simple network address for that. Now when we use registry server, then such microserv...

Setting up ReactJS for development and deployment

In this tutorial we will learn how to create a react application. Softwares required for ReactJS We need to install below softwares for react development. Visual studio code This software is free and can be downloaded from  https://code.visualstudio.com/download . Once downloaded, extract the zip  and place the binary under "Applications" and allow app access from System Preferences -> Security & privacy. Node.JS and NPM Node.JS provides a java script enabled environment to run on a web server. It eases our development for UI based applications. NPM is a package manager which installs along with Node.jS and helpful in installing packages and libraries. Install Node.JS and NPM using brew. brew install node Check version of Node and NPM using below command. node -v npm -v Create React application To create react application we will first install the required package and latter will use it to create our ReactJS application. Install create-react-app pa...

Setting up Spring Cloud Data Flow Server

Spring cloud data flow server can be used to setup the pipeline of tasks or streams. Tasks and streams can be registered with data flow server and can be executed or monitored either using cloud data flow shell or data flow server UI console/ dashboard. Setting up Data flow server Spring cloud data flow server can be setup using two ways, either use spring provided spring boot application or develop your own spring cloud data flow server as spring boot application. Using Spring provided Data flow server application There are many ways to setup data flow server as given below. Local Machine Cloud Foundry Kubernetes Please refer below documentation for more details for above installation types. https://dataflow.spring.io/docs/installation/ Create Spring boot application as Data flow server Here I will show you how to create your own spring boot application as spring cloud data flow server which you can run anywhere locally or in cloud. It gives you more freedom with appl...

Microservices - Config management using Spring cloud bus and Rabbit MQ

In this tutorial we will learn how to add Rabbit MQ capabilities to our Spring cloud config server so any changes to configurations can be pushed to all connected applications during runtime. We need such kind of behaviour when we need to refresh the properties without restarting our application. Below is the overall architecture for this complete setup. Spring Cloud Config Server Spring cloud config server is used to setup the distributed configuration using GIT or local file system where we can keep our configuration files and serve as them from Spring cloud config server. Client application just has to connect with config server by providing their application and profile name for specific configuration. Please refer below link where I have explained more about cloud config and how to code it. https://www.thetechnojournals.com/2019/10/spring-cloud-config.html Install Rabbit MQ Please refer below link on how to install rabbit-mq and virtual host verification. https://w...

Microservices - Setting up PCF Dev for local development environment

In this tutorial we are going to learn how to setup PCF development environment in local desktop/laptop. Why PCF PCF is a multi-cloud commercial platform where customers can run enterprise applications. It provides continues delivery, security and customization of your products in cloud. So customers can focus on actualy application development and deployment. They don't need to bother much about preparing the infrastructure etc. For more details you may refer below link. https://pivotal.io/why-pivotal What is PCF Dev PCF Dev is a distribution provided by Pivotal which allows developers to run the full featured cloud foundry so development and debugging becomes easier for the developer. If you create free developer account in PCF then you will get only 2 GB memory to run your applications there while for a microservice application it may not be enough. When you setup PCF dev on your machine you don't face such challenges and memory limits to your machine only. Install...

Distributed configuration using spring cloud config

What is spring cloud config Spring cloud config helps application in externalising the configuration properties in a server/client model. Which means there is a config server where all client application connects and read the properties related to their application. Properties can be accessed basis on application name and configured profile. It supports resource based configuration using GIT repository or local file system over HTTP. Properties are managed in form of key-value pair. Though it easily integrate with spring boot application but can be used by any application in other languages also as properties can be accessed through REST URLs also. We are going to learn below things here. GIT repository for configuration management Cloud config server Config client GIT Repository Here we are going to use GIT for configuration management which will be configured in config server. Setting up a GIT repository is very easy. We have to create the properties file using some na...