我有一个代码,用于读取以队列中的对象形式传递的某些唯一ID。在通过队列使用时,我希望在每个日志中传递该唯一ID。 如何读取该属性?
公共类EcafUnitOfWork扩展了MDCUnitOfWork {
public static final String CAF_NUMBER = "cafNumber";
public EcafUnitOfWork(Exchange exchange) {
super(exchange);
Endpoint endPoint = exchange.getFromEndpoint();
String routeId=exchange.getFromRouteId();
try {
if (null != endPoint && (endPoint instanceof DirectEndpoint || endPoint instanceof ServletEndpoint
|| endPoint instanceof JettyHttpEndpoint9)) {
DigitalSign digitalSign = exchange.getIn().getBody(DigitalSign.class);
log.debug("received PDF Request {}",digitalSign);
if (null != pdfDigitalSign) {
MDC.put(UNIQUE_ID, digitalSign.getUniqueId());
}
}
} catch (Exception e) {
log.error("Error While Parsing Request {}", e);
}
}