Skip to content

Commit

Permalink
remove hystrix
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongyuanzhao000 committed Jul 19, 2020
1 parent 79c3750 commit cab7d81
Show file tree
Hide file tree
Showing 51 changed files with 2 additions and 401 deletions.
16 changes: 0 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,6 @@
<!--<module>1_services_analysis_mvn</module>-->
</modules>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Edgware.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>

Expand Down Expand Up @@ -124,11 +113,6 @@
<version>1.2.31</version>
</dependency>

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

</dependencies>

<!--<repositories>-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.integration.annotation.IntegrationComponentScan;
Expand All @@ -19,7 +18,6 @@
@EnableAsync
@IntegrationComponentScan
@EnableSwagger2
@EnableCircuitBreaker
public class AdminBasicInfoApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

import adminbasic.entity.*;
import adminbasic.service.AdminBasicInfoService;
import com.netflix.hystrix.contrib.javanica.annotation.DefaultProperties;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import edu.fudan.common.util.Response;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -20,9 +16,6 @@
*/
@RestController
@RequestMapping("/api/v1/adminbasicservice")
@DefaultProperties(defaultFallback = "fallback", commandProperties = {
@HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "15000")
})
public class AdminBasicInfoController {

@Autowired
Expand All @@ -36,165 +29,142 @@ public String home(@RequestHeader HttpHeaders headers) {

@CrossOrigin(origins = "*")
@GetMapping(path = "/adminbasic/contacts")
@HystrixCommand
public HttpEntity getAllContacts(@RequestHeader HttpHeaders headers) {
AdminBasicInfoController.LOGGER.info("[Admin Basic Info Service][Find All Contacts by admin ");
return ok(adminBasicInfoService.getAllContacts(headers));
}

@CrossOrigin(origins = "*")
@DeleteMapping(path = "/adminbasic/contacts/{contactsId}")
@HystrixCommand
public HttpEntity deleteContacts(@PathVariable String contactsId, @RequestHeader HttpHeaders headers) {
AdminBasicInfoController.LOGGER.info("[Admin Basic Info Service][Delete Contacts by admin ");
return ok(adminBasicInfoService.deleteContact(contactsId, headers));
}

@CrossOrigin(origins = "*")
@PutMapping(path = "/adminbasic/contacts")
@HystrixCommand
public HttpEntity modifyContacts(@RequestBody Contacts mci, @RequestHeader HttpHeaders headers) {
AdminBasicInfoController.LOGGER.info("[Admin Basic Info Service][Modify Contacts by admin: ");
return ok(adminBasicInfoService.modifyContact(mci, headers));
}

@CrossOrigin(origins = "*")
@PostMapping(path = "/adminbasic/contacts")
@HystrixCommand
public HttpEntity addContacts(@RequestBody Contacts c, @RequestHeader HttpHeaders headers) {
AdminBasicInfoController.LOGGER.info("[Admin Basic Info Service][Modify Contacts by admin ");
return ok(adminBasicInfoService.addContact(c, headers));
}

@CrossOrigin(origins = "*")
@GetMapping(path = "/adminbasic/stations")
@HystrixCommand
public HttpEntity getAllStations(@RequestHeader HttpHeaders headers) {
AdminBasicInfoController.LOGGER.info("[Admin Basic Info Service][Find All Station by admin ");
return ok(adminBasicInfoService.getAllStations(headers));
}

@CrossOrigin(origins = "*")
@DeleteMapping(path = "/adminbasic/stations")
@HystrixCommand
public HttpEntity deleteStation(@RequestBody Station s, @RequestHeader HttpHeaders headers) {
AdminBasicInfoController.LOGGER.info("[Admin Basic Info Service][Delete Station by admin ");
return ok(adminBasicInfoService.deleteStation(s, headers));
}

@CrossOrigin(origins = "*")
@PutMapping(path = "/adminbasic/stations")
@HystrixCommand
public HttpEntity modifyStation(@RequestBody Station s, @RequestHeader HttpHeaders headers) {
AdminBasicInfoController.LOGGER.info("[Admin Basic Info Service][Modify Station by admin ");
return ok(adminBasicInfoService.modifyStation(s, headers));
}

@CrossOrigin(origins = "*")
@PostMapping(path = "/adminbasic/stations")
@HystrixCommand
public HttpEntity addStation(@RequestBody Station s, @RequestHeader HttpHeaders headers) {
AdminBasicInfoController.LOGGER.info("[Admin Basic Info Service][Modify Station by admin");
return ok(adminBasicInfoService.addStation(s, headers));
}

@CrossOrigin(origins = "*")
@GetMapping(path = "/adminbasic/trains")
@HystrixCommand
public HttpEntity getAllTrains(@RequestHeader HttpHeaders headers) {
AdminBasicInfoController.LOGGER.info("[Admin Basic Info Service][Find All Train by admin: ");
return ok(adminBasicInfoService.getAllTrains(headers));
}

@CrossOrigin(origins = "*")
@DeleteMapping(path = "/adminbasic/trains/{id}")
@HystrixCommand
public HttpEntity deleteTrain(@PathVariable String id, @RequestHeader HttpHeaders headers) {
AdminBasicInfoController.LOGGER.info("[Admin Basic Info Service][Delete Train by admin");
return ok(adminBasicInfoService.deleteTrain(id, headers));
}

@CrossOrigin(origins = "*")
@PutMapping(path = "/adminbasic/trains")
@HystrixCommand
public HttpEntity modifyTrain(@RequestBody TrainType t, @RequestHeader HttpHeaders headers) {
AdminBasicInfoController.LOGGER.info("[Admin Basic Info Service][Modify Train by admin ");
return ok(adminBasicInfoService.modifyTrain(t, headers));
}

@CrossOrigin(origins = "*")
@PostMapping(path = "/adminbasic/trains")
@HystrixCommand
public HttpEntity addTrain(@RequestBody TrainType t, @RequestHeader HttpHeaders headers) {
AdminBasicInfoController.LOGGER.info("[Admin Basic Info Service][Modify Train by admin ");
return ok(adminBasicInfoService.addTrain(t, headers));
}

@CrossOrigin(origins = "*")
@GetMapping(path = "/adminbasic/configs")
@HystrixCommand
public HttpEntity getAllConfigs(@RequestHeader HttpHeaders headers) {
AdminBasicInfoController.LOGGER.info("[Admin Basic Info Service][Find All Config by admin ");
return ok(adminBasicInfoService.getAllConfigs(headers));
}

@CrossOrigin(origins = "*")
@DeleteMapping(path = "/adminbasic/configs/{name}")
@HystrixCommand
public HttpEntity deleteConfig(@PathVariable String name, @RequestHeader HttpHeaders headers) {
AdminBasicInfoController.LOGGER.info("[Admin Basic Info Service][Delete Config by admin ");
return ok(adminBasicInfoService.deleteConfig(name, headers));
}

@CrossOrigin(origins = "*")
@PutMapping(path = "/adminbasic/configs")
@HystrixCommand
public HttpEntity modifyConfig(@RequestBody Config c, @RequestHeader HttpHeaders headers) {
AdminBasicInfoController.LOGGER.info("[Admin Basic Info Service][Modify Config by admin ");
return ok(adminBasicInfoService.modifyConfig(c, headers));
}

@CrossOrigin(origins = "*")
@PostMapping(path = "/adminbasic/configs")
@HystrixCommand
public HttpEntity addConfig(@RequestBody Config c, @RequestHeader HttpHeaders headers) {
AdminBasicInfoController.LOGGER.info("[Admin Basic Info Service][Modify Config by admin ");
return ok(adminBasicInfoService.addConfig(c, headers));
}

@CrossOrigin(origins = "*")
@GetMapping(path = "/adminbasic/prices")
@HystrixCommand
public HttpEntity getAllPrices(@RequestHeader HttpHeaders headers) {
AdminBasicInfoController.LOGGER.info("[Admin Basic Info Service][Find All Price by admin ");
return ok(adminBasicInfoService.getAllPrices(headers));
}

@CrossOrigin(origins = "*")
@DeleteMapping(path = "/adminbasic/prices")
@HystrixCommand
public HttpEntity deletePrice(@RequestBody PriceInfo pi, @RequestHeader HttpHeaders headers) {
AdminBasicInfoController.LOGGER.info("[Admin Basic Info Service][Delete Price by admin ");
return ok(adminBasicInfoService.deletePrice(pi, headers));
}

@CrossOrigin(origins = "*")
@PutMapping(path = "/adminbasic/prices")
@HystrixCommand
public HttpEntity modifyPrice(@RequestBody PriceInfo pi, @RequestHeader HttpHeaders headers) {
AdminBasicInfoController.LOGGER.info("[Admin Basic Info Service][Modify Price by admin ");
return ok(adminBasicInfoService.modifyPrice(pi, headers));
}

@CrossOrigin(origins = "*")
@PostMapping(path = "/adminbasic/prices")
@HystrixCommand
public HttpEntity addPrice(@RequestBody PriceInfo pi, @RequestHeader HttpHeaders headers) {
AdminBasicInfoController.LOGGER.info("[Admin Basic Info Service][Add Price by admin");
return ok(adminBasicInfoService.addPrice(pi, headers));
}

private HttpEntity fallback() {
return ok(new Response<>());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.integration.annotation.IntegrationComponentScan;
Expand All @@ -19,7 +18,6 @@
@EnableAsync
@IntegrationComponentScan
@EnableSwagger2
@EnableCircuitBreaker
public class AdminOrderApplication {
public static void main(String[] args) {
SpringApplication.run(AdminOrderApplication.class, args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

import adminorder.entity.*;
import adminorder.service.AdminOrderService;
import com.netflix.hystrix.contrib.javanica.annotation.DefaultProperties;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import edu.fudan.common.util.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
Expand All @@ -18,9 +14,6 @@
*/
@RestController
@RequestMapping("/api/v1/adminorderservice")
@DefaultProperties(defaultFallback = "fallback", commandProperties = {
@HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "15000")
})
public class AdminOrderController {

@Autowired
Expand All @@ -33,31 +26,23 @@ public String home(@RequestHeader HttpHeaders headers) {

@CrossOrigin(origins = "*")
@GetMapping(path = "/adminorder")
@HystrixCommand
public HttpEntity getAllOrders(@RequestHeader HttpHeaders headers) {
return ok(adminOrderService.getAllOrders(headers));
}

@PostMapping(value = "/adminorder")
@HystrixCommand
public HttpEntity addOrder(@RequestBody Order request, @RequestHeader HttpHeaders headers) {
return ok(adminOrderService.addOrder(request, headers));
}

@PutMapping(value = "/adminorder")
@HystrixCommand
public HttpEntity updateOrder(@RequestBody Order request, @RequestHeader HttpHeaders headers) {
return ok(adminOrderService.updateOrder(request, headers));
}

@DeleteMapping(value = "/adminorder/{orderId}/{trainNumber}")
@HystrixCommand
public HttpEntity deleteOrder(@PathVariable String orderId, @PathVariable String trainNumber, @RequestHeader HttpHeaders headers) {
return ok(adminOrderService.deleteOrder(orderId, trainNumber, headers));
}


private HttpEntity fallback() {
return ok(new Response<>());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.integration.annotation.IntegrationComponentScan;
Expand All @@ -19,7 +18,6 @@
@EnableAsync
@IntegrationComponentScan
@EnableSwagger2
@EnableCircuitBreaker
public class AdminRouteApplication {
public static void main(String[] args) {
SpringApplication.run(AdminRouteApplication.class, args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

import adminroute.entity.RouteInfo;
import adminroute.service.AdminRouteService;
import com.netflix.hystrix.contrib.javanica.annotation.DefaultProperties;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import edu.fudan.common.util.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
Expand All @@ -18,9 +14,6 @@
*/
@RestController
@RequestMapping("/api/v1/adminrouteservice")
@DefaultProperties(defaultFallback = "fallback", commandProperties = {
@HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "15000")
})
public class AdminRouteController {

@Autowired
Expand All @@ -33,25 +26,19 @@ public String home(@RequestHeader HttpHeaders headers) {

@CrossOrigin(origins = "*")
@GetMapping(path = "/adminroute")
@HystrixCommand
public HttpEntity getAllRoutes(@RequestHeader HttpHeaders headers) {
return ok(adminRouteService.getAllRoutes(headers));
}

@PostMapping(value = "/adminroute")
@HystrixCommand
public HttpEntity addRoute(@RequestBody RouteInfo request, @RequestHeader HttpHeaders headers) {
return ok(adminRouteService.createAndModifyRoute(request, headers));
}

@DeleteMapping(value = "/adminroute/{routeId}")
@HystrixCommand
public HttpEntity deleteRoute(@PathVariable String routeId, @RequestHeader HttpHeaders headers) {
return ok(adminRouteService.deleteRoute(routeId, headers));
}


private HttpEntity fallback() {
return ok(new Response<>());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.integration.annotation.IntegrationComponentScan;
Expand All @@ -19,7 +18,6 @@
@EnableAsync
@IntegrationComponentScan
@EnableSwagger2
@EnableCircuitBreaker
public class AdminTravelApplication {
public static void main(String[] args) {
SpringApplication.run(AdminTravelApplication.class, args);
Expand Down
Loading

0 comments on commit cab7d81

Please sign in to comment.