Updated with Hystrix integration to spring app
This commit is contained in:
		
							parent
							
								
									6f2ccdf187
								
							
						
					
					
						commit
						3c31664ea0
					
				
							
								
								
									
										13
									
								
								hystrix/src/main/java/com/baeldung/hystrix/AppConfig.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								hystrix/src/main/java/com/baeldung/hystrix/AppConfig.java
									
									
									
									
									
										Normal 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); | ||||
|     } | ||||
| } | ||||
| @ -0,0 +1,7 @@ | ||||
| package com.baeldung.hystrix; | ||||
| 
 | ||||
| /** | ||||
|  * Created by sbalachandran on 8/5/2016. | ||||
|  */ | ||||
| public class HystrixAspect { | ||||
| } | ||||
| @ -0,0 +1,7 @@ | ||||
| package com.baeldung.hystrix; | ||||
| 
 | ||||
| /** | ||||
|  * Created by sbalachandran on 8/5/2016. | ||||
|  */ | ||||
| public class HystrixCircuitBreaker { | ||||
| } | ||||
| @ -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(); | ||||
|     } | ||||
| } | ||||
| @ -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."; | ||||
|     } | ||||
| } | ||||
| @ -0,0 +1,7 @@ | ||||
| package com.baeldung.hystrix; | ||||
| 
 | ||||
| /** | ||||
|  * Created by sbalachandran on 8/5/2016. | ||||
|  */ | ||||
| public class SpringExistingClient { | ||||
| } | ||||
							
								
								
									
										0
									
								
								hystrix/src/main/resources/application.properties
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								hystrix/src/main/resources/application.properties
									
									
									
									
									
										Normal file
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user