diff --git a/hystrix/src/main/java/com/baeldung/hystrix/AppConfig.java b/hystrix/src/main/java/com/baeldung/hystrix/AppConfig.java new file mode 100644 index 0000000000..8102428e9a --- /dev/null +++ b/hystrix/src/main/java/com/baeldung/hystrix/AppConfig.java @@ -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); + } +} diff --git a/hystrix/src/test/java/com/baeldung/hystrix/CommandHelloWorld.java b/hystrix/src/main/java/com/baeldung/hystrix/CommandHelloWorld.java similarity index 100% rename from hystrix/src/test/java/com/baeldung/hystrix/CommandHelloWorld.java rename to hystrix/src/main/java/com/baeldung/hystrix/CommandHelloWorld.java diff --git a/hystrix/src/main/java/com/baeldung/hystrix/HystrixAspect.java b/hystrix/src/main/java/com/baeldung/hystrix/HystrixAspect.java new file mode 100644 index 0000000000..2ea0163ab1 --- /dev/null +++ b/hystrix/src/main/java/com/baeldung/hystrix/HystrixAspect.java @@ -0,0 +1,7 @@ +package com.baeldung.hystrix; + +/** + * Created by sbalachandran on 8/5/2016. + */ +public class HystrixAspect { +} diff --git a/hystrix/src/main/java/com/baeldung/hystrix/HystrixCircuitBreaker.java b/hystrix/src/main/java/com/baeldung/hystrix/HystrixCircuitBreaker.java new file mode 100644 index 0000000000..9377d83495 --- /dev/null +++ b/hystrix/src/main/java/com/baeldung/hystrix/HystrixCircuitBreaker.java @@ -0,0 +1,7 @@ +package com.baeldung.hystrix; + +/** + * Created by sbalachandran on 8/5/2016. + */ +public class HystrixCircuitBreaker { +} diff --git a/hystrix/src/main/java/com/baeldung/hystrix/HystrixController.java b/hystrix/src/main/java/com/baeldung/hystrix/HystrixController.java new file mode 100644 index 0000000000..a8ca0adef2 --- /dev/null +++ b/hystrix/src/main/java/com/baeldung/hystrix/HystrixController.java @@ -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(); + } +} diff --git a/hystrix/src/main/java/com/baeldung/hystrix/RemoteServiceSimulator.java b/hystrix/src/main/java/com/baeldung/hystrix/RemoteServiceSimulator.java deleted file mode 100644 index 3efd579d84..0000000000 --- a/hystrix/src/main/java/com/baeldung/hystrix/RemoteServiceSimulator.java +++ /dev/null @@ -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."; - } -} diff --git a/hystrix/src/test/java/com/baeldung/hystrix/RemoteServiceTestCommand.java b/hystrix/src/main/java/com/baeldung/hystrix/RemoteServiceTestCommand.java similarity index 100% rename from hystrix/src/test/java/com/baeldung/hystrix/RemoteServiceTestCommand.java rename to hystrix/src/main/java/com/baeldung/hystrix/RemoteServiceTestCommand.java diff --git a/hystrix/src/test/java/com/baeldung/hystrix/RemoteServiceTestSimulator.java b/hystrix/src/main/java/com/baeldung/hystrix/RemoteServiceTestSimulator.java similarity index 100% rename from hystrix/src/test/java/com/baeldung/hystrix/RemoteServiceTestSimulator.java rename to hystrix/src/main/java/com/baeldung/hystrix/RemoteServiceTestSimulator.java diff --git a/hystrix/src/main/java/com/baeldung/hystrix/SpringExistingClient.java b/hystrix/src/main/java/com/baeldung/hystrix/SpringExistingClient.java new file mode 100644 index 0000000000..b08f61a777 --- /dev/null +++ b/hystrix/src/main/java/com/baeldung/hystrix/SpringExistingClient.java @@ -0,0 +1,7 @@ +package com.baeldung.hystrix; + +/** + * Created by sbalachandran on 8/5/2016. + */ +public class SpringExistingClient { +} diff --git a/hystrix/src/main/resources/application.properties b/hystrix/src/main/resources/application.properties new file mode 100644 index 0000000000..e69de29bb2