Add additional app to test turbine cluster config

This commit is contained in:
Dave Syer
2016-04-04 16:59:27 +01:00
parent faed34914c
commit f63b0bf926
3 changed files with 15 additions and 13 deletions

View File

@@ -1,4 +1,5 @@
server.port: 8989
spring.application.name: turbine
turbine.appConfig: simple
turbine.aggregator.clusterConfig: SIMPLE
turbine.appConfig: simple,other
turbine.aggregator.clusterConfig: MAIN
turbine.clusterNameExpression: metadata['cluster']

View File

@@ -36,47 +36,47 @@ import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
@EnableCircuitBreaker
@RestController
public class SimpleApplication {
@Autowired
private HelloService service;
@RequestMapping("/")
public String hello() {
return service.hello();
return this.service.hello();
}
@RequestMapping("/session")
public String session(HttpSession session) {
return session.getId();
}
@RequestMapping("/fail")
public String fail() {
return service.fail();
return this.service.fail();
}
public static void main(String[] args) {
new SpringApplicationBuilder(SimpleApplication.class).properties(
"spring.config.name:simple").run(args);
}
@Service
public static class HelloService {
@HystrixCommand(fallbackMethod="fallback")
public String hello() {
return "Hello World";
}
@HystrixCommand(fallbackMethod="fallback")
public String fail() {
throw new RuntimeException("Planned");
}
public String fallback() {
return "Fallback";
}
}
}

View File

@@ -1,2 +1,3 @@
server.port: 8080
spring.application.name: simple
eureka.instance.metadata-map.cluster: MAIN