Updated with Hystrix integration to spring app

This commit is contained in:
sbalachandran 2016-08-07 22:06:57 -04:00
parent 6f2ccdf187
commit 3c31664ea0
10 changed files with 51 additions and 15 deletions

View File

@ -0,0 +1,13 @@
package com.baeldung.hystrix;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
@SpringBootApplication
public class AppConfig {
public static void main(String[] args) {
SpringApplication.run(AppConfig.class, args);
}
}

View File

@ -0,0 +1,7 @@
package com.baeldung.hystrix;
/**
* Created by sbalachandran on 8/5/2016.
*/
public class HystrixAspect {
}

View File

@ -0,0 +1,7 @@
package com.baeldung.hystrix;
/**
* Created by sbalachandran on 8/5/2016.
*/
public class HystrixCircuitBreaker {
}

View File

@ -0,0 +1,17 @@
package com.baeldung.hystrix;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HystrixController {
@Autowired
private SpringExistingClient client;
@RequestMapping("/")
public String index() throws InterruptedException{
return client.invokeRemoteService();
}
}

View File

@ -1,15 +0,0 @@
package com.baeldung.hystrix;
public class RemoteServiceSimulator {
public String checkSomething(final long timeout) throws InterruptedException {
System.out.print(String.format("Waiting %sms. ", timeout));
// to simulate a real world delay in processing.
Thread.sleep(timeout);
return "Done waiting.";
}
}

View File

@ -0,0 +1,7 @@
package com.baeldung.hystrix;
/**
* Created by sbalachandran on 8/5/2016.
*/
public class SpringExistingClient {
}