Commit 225eb286 authored by Narendar Vakiti's avatar Narendar Vakiti

added zipkin and sleuth

parent 3ff6cb57
......@@ -9,5 +9,6 @@ This springboot application is for call rest services from BookStore API (https:
3. Used Feign Client
4. Added Eureka Client
5. Added to Zuul Proxy Server
6. Added Zipkin and sleuth
......@@ -34,15 +34,27 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
......
......@@ -2,9 +2,12 @@ package com.bookstore;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
@SpringBootApplication
@EnableHystrix
......@@ -16,4 +19,10 @@ public class BookstoreApplication {
SpringApplication.run(BookstoreApplication.class, args);
}
@Bean
@LoadBalanced
public RestTemplate getRestTemplate(){
return new RestTemplate();
}
}
......@@ -103,6 +103,7 @@ public class BookStoreController {
try{
responseEntity = bookFeignService.getBookDetails();
response = responseEntity.getBody();
logger.info("Book details response :: "+response);
}catch(Exception e){
logger.error("Exception while fetching book details :: "+e.getMessage());
......
......@@ -4,7 +4,10 @@ spring:
eureka:
client:
registerWithEureka: true
fetchRegistry: true
serviceUrl:
defaultZone: ${EUREKA_URI:http://localhost:8761/eureka}
defaultZone: http://localhost:8761/eureka
instance:
preferIpAddress: true
\ No newline at end of file
preferIpAddress: true
hostname: localhost
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment