Coder Social home page Coder Social logo

santteegt / spring-cloud-zookeeper-service-discovery-demo Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 6.0 15 KB

Tutorial using docker compose to present an spring cloud zookeeper service discovery demo

License: Apache License 2.0

Java 78.00% Dockerfile 22.00%
docker spring-boot zookeeper curator java-8 maven

spring-cloud-zookeeper-service-discovery-demo's Introduction

spring-cloud-zookeeper-service-discovery-demo

Tutorial using docker compose to present a hands-on session on how to use spring cloud zookeeper for service discovery.

How is works ?

This tutorial includes two (Spring Boot) microservices called GreetingMicroservice and GreetingConsumer. So, the aim of this tutorial is to demonstrate how a consumer can discover the Greeting service through Apache Zookeeper and Apache Curator Service Discovery. The latter can be easily implemented in Spring Boot applications using the Spring Cloud Zookeeper API. We also used Netflix Feign for writing the REST consumer behavour. Finally, for this demonstration, we use a Zookeeper instance with 2 nodes (see Docker Compose).

Installation Instructions

  1. Requirements
  • Docker 3.2+
  1. Run the following commands
$ git clone <REPO_GIT_URL>
$ cd spring-cloud-zookeeper-service-discovery-demo
$ docker-compose up 

Checking everything works

Once the compose is deployed, make a request using the consumer microservice by accesing the following URL: http://localhost:8180/get-greeting

Implementation notes

GreetingMicroservice

  • GreetingMicroservice has the SimpleController class which implements an Spring Boot application and specify the @EnableDiscoveryClient annotation to automatically enable the Discovery Client implementation and register the service in a zookeeper instance.
  • The spring.cloud.zookeeper.connect-string 'spring.application.name' must be specificed in the application.yml file.

GreetingConsumer

  • The ServiceConsumerClient class manages the communication with the Service Discovery by implementing a REST call using a FeignClient and the service name specified in the GreetingMicroservice's application.yml file.

spring-cloud-zookeeper-service-discovery-demo's People

Contributors

conorkotwasinski avatar santteegt avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

spring-cloud-zookeeper-service-discovery-demo's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.