Skip to content

Commit

Permalink
Step44
Browse files Browse the repository at this point in the history
  • Loading branch information
Ranga Rao Karanam authored and Ranga Rao Karanam committed Sep 11, 2017
1 parent 6266f44 commit 391863d
Show file tree
Hide file tree
Showing 5 changed files with 3,607 additions and 0 deletions.
7 changes: 7 additions & 0 deletions 03.microservices/limits-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,17 @@
</properties>

<dependencies>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.springframework.web.bind.annotation.RestController;

import com.in28minutes.microservices.limitsservice.bean.LimitConfiguration;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;

@RestController
public class LimitsConfigurationController {
Expand All @@ -18,4 +19,15 @@ public LimitConfiguration retrieveLimitsFromConfigurations() {
configuration.getMinimum());
return limitConfiguration;
}

@GetMapping("/fault-tolerance-example")
@HystrixCommand(fallbackMethod="fallbackRetrieveConfiguration")
public LimitConfiguration retrieveConfiguration() {
throw new RuntimeException("Not available");
}

public LimitConfiguration fallbackRetrieveConfiguration() {
return new LimitConfiguration(999, 9);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;

@SpringBootApplication
@EnableHystrix
public class LimitsServiceApplication {
public static void main(String[] args) {
SpringApplication.run(LimitsServiceApplication.class, args);
Expand Down
Loading

0 comments on commit 391863d

Please sign in to comment.