I want to increase the timeout of an API at the controller level. For all API we can do by mentioning the following in my yml file:
ribbon:
ReadTimeout: 30000
ConnectTimeout: 30000
But I want timeout increase timeout for a particular API. As it is a long process API. How can we achieve this?
@GetMapping(value = { "", "/" })
public ResponseEntity<Page<DBInventoryMasterEntity>> fetch() {
Page<DBInventoryMasterEntity> returnList = null;
returnList = inventoryService.findByCustomerCode();
return ResponseEntity.ok(returnList);
}
You can try these two methods:
Callable<>
. See this answer. @GetMapping(value = { "", "/" })
@Timed
@Transactional(timeout = 120) // 2 minutes
public ResponseEntity<Page<DBInventoryMasterEntity>> fetch() {
// your code
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.