Tag Archives: Netflix

Spring Cloud: Creating REST Client Using Feign

In this tutorial we will be exploring Spring Cloud Feign component.

What is Feign?

Feign is a declarative REST Client. With the help of Feign, you can declare web services as interfaces in your application. And you can simply use those interfaces to consume those web services. While runtime Feign will provide actual REST API implementation.

TL;DR You can download whole project by clicking following link.

To give you a brief idea… In this tutorial, we will be consuming web service using Feign.

Continue reading Spring Cloud: Creating REST Client Using Feign

Spring Cloud: Creating REST Client Using Ribbon

This is a quick tutorial for creating a REST API client using Spring Cloud Ribbon component. For this tutorial, you will need a running Eureka server and a Eureka client application. In case if you do not have Eureka server or a Eureka client application, check out my previous posts which explain how to setup eureka server and how to develop a eureka client application.

What is Ribbon?

In short, Ribbon is a load balancer. Let’s say you have a service which is used by 1000’s of customers. In that case, you may have multiple instances of service running on multiple servers for load balancing purpose. Now if you want to consume that service in another service, you should not hard code its URL. Because that will always point to only one service and will defeat the purpose of load balancing.

Ribbon helps us to solve this issue. Ribbon on backend talks with Eureka server and will get all instances of services and try to distribute the load across instances.

TL;DR You can download whole project by clicking following link.

To give you a brief idea about the project… We will have a producer which we will be launching multiple times. We will be creating a consumer with Ribbon which will consume the service exposed by the producer. At the same time, it will take care of load balancing as well.

Continue reading Spring Cloud: Creating REST Client Using Ribbon

Spring Cloud: Creating Student Service With Eureka

In this post, we will be creating a eureka client application. We will be creating a sample Student service. This service will have two functionalities viz. to retrieve information about all students or you can pass a specific student id and retrieve information of that particular student.

We will be also making some changes in the application.properties file to spin multiple instances of this application on same/one machine.

TL;DR You can download whole project by clicking following link.

Before we begin, you will need to set up the eureka server. In case if you don’t know how to setup eureka server then please checkout Setting Up Eureka Server Using Spring Cloud first.

Continue reading Spring Cloud: Creating Student Service With Eureka

Spring Cloud: Consuming Eureka client application With another eureka client and Rest Template (Part 3)

This is a quick tutorial for consuming services exposed by one Eureka client application in another Eureka client application. This tutorial has the prerequisite of a running Eureka server and a Eureka client application as well. In case if you do not have Eureka server or a Eureka client application, check out my previous posts in this series which explains how to setup eureka server and how to develop a eureka client application.

The eureka client which we will be developing in this tutorial will be registered in eureka server and will consume service exposed by another client application.

TL;DR You can download whole project by clicking following link.

To give you a brief idea about what we are developing… We will be creating a Eureka client in this tutorial. The client will be a spring boot application and will expose one rest endpoint. The client will also internally consume service exposed by another eureka client application.

Continue reading Spring Cloud: Consuming Eureka client application With another eureka client and Rest Template (Part 3)

Spring Cloud: Creating first client application With eureka client (Part 2)

This is a quick tutorial for creating a eureka client application. This tutorial has the prerequisite of a running eureka server. In case if you do not have running eureka server or a newbie, check out my previous post in this series which explains how to setup eureka server yourself. The eureka client which we will be developing in this tutorial will be registered in the eureka server.

TL;DR You can download whole project by clicking following link.

We will be creating a Eureka client in this tutorial. The client will be a spring boot application and will expose one rest endpoint. That endpoint will accept one value (or String, as said in Java world) as path parameter and will prefix it with ‘Hello’. The endpoint will return its result as String again.

Continue reading Spring Cloud: Creating first client application With eureka client (Part 2)

Setting Up Eureka Server Using Spring Cloud (Part 1)

This is a quick example for setting up Eureka server using Spring Cloud.

You can download the whole project by using following link.

For this tutorial, we will be creating a New Maven Project. To keep thing more simple we will be creating a simple maven project i.e. we will be skipping archetype selection.

New Maven Project Wizard – Creating a simple project
Continue reading Setting Up Eureka Server Using Spring Cloud (Part 1)