diff --git a/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/controller/GatewayController.java b/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/controller/GatewayController.java index b0a17024d..00a253ba4 100644 --- a/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/controller/GatewayController.java +++ b/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/controller/GatewayController.java @@ -39,6 +39,7 @@ import ru.spcex.clearing.gatewayapi.service.processor.ListingFondProcessor; import ru.spcex.clearing.gatewayapi.service.processor.ListingMMProcessor; import ru.spcex.platform.utils.enumeration.EnumMessage; import ru.spcex.platform.utils.enumeration.IMessageResolver; +import ru.spcex.platform.utils.log.ExceptionUtils; @Controller @RequestMapping("/") @@ -92,7 +93,13 @@ public class GatewayController { @ResponseBody public CommonResponse listingsFond(@RequestBody FondListingsRequest request) { // request.validate(validTypes, List.of(Section.FOND)); - executor.submit(() -> listingFondProcessor.process(request)); + executor.submit(() -> { + try { + listingFondProcessor.process(request); + } catch (Throwable e) { + log.error("At process /listing_fond has error: {}", ExceptionUtils.getStackTrace(e)); + } + }); return createResponse(request, true); } @@ -111,7 +118,13 @@ public class GatewayController { @ResponseBody public CommonResponse listingsMM(@RequestBody MMListingsRequest request) { // request.validate(validTypes, List.of(Section.MKR)); - executor.submit(() -> listingMMProcessor.process(request)); + executor.submit(() -> { + try { + listingMMProcessor.process(request); + } catch (Throwable e) { + log.error("At process /listing_mm has error: {}", ExceptionUtils.getStackTrace(e)); + } + }); return createResponse(request, true); } @@ -130,7 +143,13 @@ public class GatewayController { @ResponseBody public CommonResponse listingsCurr(@RequestBody CurrListingsRequest request) { // request.validate(validTypes, List.of(Section.CURR)); - executor.submit(() -> listingCurrProcessor.process(request)); + executor.submit(() -> { + try { + listingCurrProcessor.process(request); + } catch (Throwable e) { + log.error("At process /listing_curr has error: {}", ExceptionUtils.getStackTrace(e)); + } + }); return createResponse(request, true); } @@ -149,7 +168,13 @@ public class GatewayController { @ResponseBody public CommonResponse companies(@RequestBody CompaniesRequest request) { // request.validate(validTypes, Collections.emptyList()); - executor.submit(() -> companiesProcessor.process(request)); + executor.submit(() -> { + try { + companiesProcessor.process(request); + } catch (Throwable e) { + log.error("At process /companies has error: {}", ExceptionUtils.getStackTrace(e)); + } + }); return createResponse(request, true); } @@ -167,7 +192,13 @@ public class GatewayController { @ResponseBody public CommonResponse limits(@RequestBody LimitRequest request) { log.debug("Received message: {}", request); - executor.submit(() -> notificationService.sendLimitNotification(request)); + executor.submit(() -> { + try { + notificationService.sendLimitNotification(request); + } catch (Throwable e) { + log.error("At process /limits has error: {}", ExceptionUtils.getStackTrace(e)); + } + }); return createCommonResponse(request.getId()); } @@ -185,8 +216,12 @@ public class GatewayController { public CommonResponse operations(@RequestBody OperationsRequest request) { log.debug("Received message: {}", request); executor.submit(() -> { - operationService.checkAssetsAndSendMessage(request); - notificationService.sendToJournal(request); + try { + operationService.checkAssetsAndSendMessage(request); + notificationService.sendToJournal(request); + } catch (Throwable e) { + log.error("At process /operations has error: {}", ExceptionUtils.getStackTrace(e)); + } }); return createCommonResponse(request.getId()); } @@ -205,8 +240,12 @@ public class GatewayController { public CommonResponse requestTkr(@RequestBody TkrRequest request) { log.debug("Received message: {}", request); executor.submit(() -> { - tkrService.processedTkrRequest(request); - notificationService.sendToJournal(request); + try { + tkrService.processedTkrRequest(request); + notificationService.sendToJournal(request); + } catch (Throwable e) { + log.error("At process /member_request_tkr has error: {}", ExceptionUtils.getStackTrace(e)); + } }); return createCommonResponse(request.getId()); } diff --git a/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/service/NotificationService.java b/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/service/NotificationService.java index 781395eb1..e02f84168 100644 --- a/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/service/NotificationService.java +++ b/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/service/NotificationService.java @@ -104,6 +104,7 @@ public class NotificationService { log.warn("GatewayResult by requestId = {} not found in map", request.getId().toString()); return; } + log.debug("Update gatewayResult.id={} by requestId={}", gatewayResult.getId(), request.getId()); gatewayResult.setUpdated(Instant.now()); gatewayResult.setGatewayResultStatus(resultStatus.getKey()); String res = LogFormatter.toString(request); diff --git a/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/service/processor/CompanyProcessor.java b/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/service/processor/CompanyProcessor.java index c23c4aebd..4eb9a4cb4 100644 --- a/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/service/processor/CompanyProcessor.java +++ b/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/service/processor/CompanyProcessor.java @@ -72,6 +72,7 @@ public class CompanyProcessor { log.error("{}", ExceptionUtils.getStackTrace(e)); } } + log.debug("process CompaniesRequest done"); } private List groupByCompanyId(List listToProcess, UUID companyId) { diff --git a/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/service/processor/ListingCurrProcessor.java b/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/service/processor/ListingCurrProcessor.java index d4d0b4b57..5d50064f2 100644 --- a/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/service/processor/ListingCurrProcessor.java +++ b/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/service/processor/ListingCurrProcessor.java @@ -66,5 +66,6 @@ public class ListingCurrProcessor { log.error("currencyInstrumentId={}: {}", currencyInstrumentId, ExceptionUtils.getStackTrace(e)); } } + log.debug("process CurrListingsRequest done"); } } diff --git a/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/service/processor/ListingFondProcessor.java b/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/service/processor/ListingFondProcessor.java index 73fac2122..a282b5020 100644 --- a/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/service/processor/ListingFondProcessor.java +++ b/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/service/processor/ListingFondProcessor.java @@ -1,5 +1,7 @@ package ru.spcex.clearing.gatewayapi.service.processor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import ru.spcex.clearing.gatewayapi.controller.inbound.request.listing.fond.FondListingsRequest; import ru.spcex.clearing.gatewayapi.service.IssueCompanyService; @@ -7,6 +9,7 @@ import ru.spcex.clearing.gatewayapi.service.SecurityService; @Service public class ListingFondProcessor { + private final Logger log = LoggerFactory.getLogger(getClass()); private final IssueCompanyService issueCompanyProcessor; private final SecurityService securityService; @@ -18,5 +21,6 @@ public class ListingFondProcessor { public void process(FondListingsRequest request) { issueCompanyProcessor.sendRequest(request); securityService.sendRequest(request); + log.debug("process FondListingsRequest done"); } } diff --git a/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/service/processor/ListingMMProcessor.java b/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/service/processor/ListingMMProcessor.java index 91647e82d..c439134d0 100644 --- a/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/service/processor/ListingMMProcessor.java +++ b/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/service/processor/ListingMMProcessor.java @@ -58,5 +58,6 @@ public class ListingMMProcessor { log.error("{}", ExceptionUtils.getStackTrace(e)); } } + log.debug("process MMListingsRequest done"); } }