zzhangllei edited a comment on issue #455: Failed to get reconnected sender, all alpha server is down. URL: https://github.com/apache/servicecomb-pack/issues/455#issuecomment-487434331 入口 @SagaStart(timeout = 100) @RequestMapping("/helloMsg") public String helloMsg(String name , Integer car ) { asyncUtils.retMsg(name, car); asyncUtils.retMsg1(name, car); return "test"; } Util @Component public class AsyncUtils { @Resource FeignService feignService; @Resource CarService carService; @Resource HotelService hotelService; public Future<String> retMsg(String name, Integer cars) { carService.order(); return new AsyncResult<String>("test"); } public Future<String> retMsg1(String name, Integer rooms) { hotelService.order(); return new AsyncResult<String>("test"); } } feign @FeignClient(value = "car", fallback = CarServiceImpl.class) public interface CarService { //服务中方法的映射路径 @RequestMapping("/order/{name}/{car}") Map<String,Object> order(@PathVariable String name , @PathVariable Integer cars) ; //服务中方法的映射路径 @RequestMapping("/order") Map<String,Object> order() ; } 子服务 @RequestMapping(path = "/order") public CarBooking order() { CarBooking carBooking = new CarBooking(); carBooking.setId(id.incrementAndGet()); carBooking.setName("zl"); carBooking.setAmount(2); service.order(carBooking); return carBooking ; } @Service class CarBookingService { private Map<Integer, CarBooking> bookings = new ConcurrentHashMap<>(); @Compensable(timeout = 5 , compensationMethod = "cancel") void order(CarBooking booking) { System.out.println("预定汽车开始"); booking.confirm(); bookings.put(booking.getId(), booking); } void cancel(CarBooking booking) { System.out.println("预定汽车取消"); Integer id = booking.getId(); if (bookings.containsKey(id)) { bookings.get(id).cancel(); } } Collection<CarBooking> getAllBookings() { return bookings.values(); } void clearAllBookings() { bookings.clear(); } }
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services