This commit is contained in:
parent
2b5a065466
commit
6b04b11e9f
6 changed files with 36 additions and 2 deletions
|
|
@ -12,6 +12,7 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
|
||||
|
||||
|
|
@ -26,7 +27,6 @@ public class RequestCachingFilter extends OncePerRequestFilter {
|
|||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response,
|
||||
FilterChain filterChain) throws ServletException, IOException {
|
||||
CachedHttpServletRequest cachedHttpServletRequest = new CachedHttpServletRequest(request);
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("received {} request, destination '{}', body: {}",
|
||||
request.getMethod(),
|
||||
|
|
@ -37,6 +37,12 @@ public class RequestCachingFilter extends OncePerRequestFilter {
|
|||
filterChain.doFilter(cachedHttpServletRequest, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldNotFilter(HttpServletRequest request) throws ServletException {
|
||||
return request.getServletPath().equals("/login") ||
|
||||
RequestMethod.GET.name().equals(request.getMethod());
|
||||
}
|
||||
|
||||
private static String removeWhiteSpaces(byte[] cachedPayload) {
|
||||
if (cachedPayload == null || cachedPayload.length == 0) {
|
||||
return "[empty]";
|
||||
|
|
|
|||
|
|
@ -513,4 +513,9 @@ public class OrderCurrencyListener extends QueueConsumer implements Initializing
|
|||
String digits = parts[2];
|
||||
return Long.valueOf(digits);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isEnableRequestLogging() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,4 +97,9 @@ public class OvernightSettingsListener extends QueueConsumer implements Initiali
|
|||
log.info("updated overnight system request.id[{}]: {}/{}/{}", os.getId(), os.getCompanyId(), os.getMarket(), os.getOvernightType());
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isEnableRequestLogging() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -239,4 +239,9 @@ public class TaskListener extends QueueConsumer implements InitializingBean {
|
|||
newReq.setComment(comment);
|
||||
kafkaSender.sendRequestToQueue(Consts.NOTIFICATION_NEW, newReq);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isEnableRequestLogging() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,9 @@ public class SwapOvernightOrderService {
|
|||
FinalCalculationResult finalCalculationResult = swapCalculationService.calcAndEnrichSwap(SettleCode.T1, context);
|
||||
if (CurrencyCode.RUB == currency &&
|
||||
finalCalculationResult.calculationResult().sum3().compareTo(BigDecimal.ZERO) >= 0) {
|
||||
log.warn("QuantityLot greater than zero; skip forming order currency");
|
||||
log.warn("QuantityLot greater than zero :{}; skip forming order currency by registry: {}",
|
||||
finalCalculationResult.calculationResult().sum3(),
|
||||
registry.getId());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -103,6 +103,8 @@ public class QueueConsumer implements AutoCloseable {
|
|||
ConsumerSpecificClass<?> callback = callbacks.get(next.topic());
|
||||
Class<?> clazz = callback.getClazz();
|
||||
JavaType payloadType = json.getTypeFactory().constructParametricType(BaseRequest.class, clazz);
|
||||
String msg = (String) next.value();
|
||||
loggingReq(lastTopic, msg);
|
||||
o = json.readValue((String) next.value(), payloadType);
|
||||
if (correlationId != null) {
|
||||
((BaseRequest<?>) o).setCorrelationId(correlationId.value());
|
||||
|
|
@ -210,7 +212,16 @@ public class QueueConsumer implements AutoCloseable {
|
|||
return ConsumerSpecificClass.build(clazz);
|
||||
}
|
||||
|
||||
private void loggingReq(String topic, String msg){
|
||||
if (isEnableRequestLogging()) {
|
||||
log.debug("Kafka message received | topic='{}' | payload={}",
|
||||
topic, msg);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isEnableRequestLogging() {
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Валидация запроса
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue