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: ...@@ -9,5 +9,6 @@ This springboot application is for call rest services from BookStore API (https:
3. Used Feign Client 3. Used Feign Client
4. Added Eureka Client 4. Added Eureka Client
5. Added to Zuul Proxy Server 5. Added to Zuul Proxy Server
6. Added Zipkin and sleuth
...@@ -34,15 +34,27 @@ ...@@ -34,15 +34,27 @@
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId> <artifactId>spring-boot-starter-actuator</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId> <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
......
...@@ -2,9 +2,12 @@ package com.bookstore; ...@@ -2,9 +2,12 @@ package com.bookstore;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; 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.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.EnableHystrix; import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
@SpringBootApplication @SpringBootApplication
@EnableHystrix @EnableHystrix
...@@ -16,4 +19,10 @@ public class BookstoreApplication { ...@@ -16,4 +19,10 @@ public class BookstoreApplication {
SpringApplication.run(BookstoreApplication.class, args); SpringApplication.run(BookstoreApplication.class, args);
} }
@Bean
@LoadBalanced
public RestTemplate getRestTemplate(){
return new RestTemplate();
}
} }
...@@ -103,6 +103,7 @@ public class BookStoreController { ...@@ -103,6 +103,7 @@ public class BookStoreController {
try{ try{
responseEntity = bookFeignService.getBookDetails(); responseEntity = bookFeignService.getBookDetails();
response = responseEntity.getBody(); response = responseEntity.getBody();
logger.info("Book details response :: "+response);
}catch(Exception e){ }catch(Exception e){
logger.error("Exception while fetching book details :: "+e.getMessage()); logger.error("Exception while fetching book details :: "+e.getMessage());
......
...@@ -4,7 +4,10 @@ spring: ...@@ -4,7 +4,10 @@ spring:
eureka: eureka:
client: client:
registerWithEureka: true
fetchRegistry: true
serviceUrl: serviceUrl:
defaultZone: ${EUREKA_URI:http://localhost:8761/eureka} defaultZone: http://localhost:8761/eureka
instance: instance:
preferIpAddress: true 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