|
@ -273,41 +273,29 @@ public class JMSAppender extends AppenderSkeleton {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
if (StringUtil.isEmpty(event.getMDC("camel.messageId"))) {
|
|
|
return;
|
|
|
}
|
|
|
ObjectMessage msg = topicSession.createObjectMessage();
|
|
|
String message = event.getMessage().toString();
|
|
|
String routeId = StringUtil.toString(event.getMDC("camel.routeId"));
|
|
|
if (message.contains("("+routeId+") log[servers:")) {
|
|
|
String body = message.substring(message.indexOf("Body:") + 5);
|
|
|
String code = "";
|
|
|
String order = "0";
|
|
|
String totalServers = message.substring(message.indexOf("log[servers:") + 13, message.indexOf(","));
|
|
|
if (!totalServers.equals("0")) {
|
|
|
code = message.substring(message.indexOf("code") + 6, message.indexOf(",order"));
|
|
|
order = message.substring(message.indexOf("order") + 7, message.indexOf("]"));
|
|
|
try {
|
|
|
if (StringUtil.isEmpty(event.getMDC("camel.messageId"))) {
|
|
|
return;
|
|
|
}
|
|
|
ObjectMessage msg = topicSession.createObjectMessage();
|
|
|
String message = event.getMessage().toString();
|
|
|
String body = message.substring(message.indexOf("Body:") + 5);
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
map.put("exchangeId", StringUtil.toString(event.getMDC("camel.exchangeId")));
|
|
|
map.put("correlationId", StringUtil.toString(event.getMDC("camel.correlationId")));
|
|
|
map.put("transactionKey", StringUtil.toString(event.getMDC("camel.transactionKey")));
|
|
|
map.put("routeId", StringUtil.toString(event.getMDC("camel.routeId")));
|
|
|
map.put("breadcrumbId", StringUtil.toString(event.getMDC("camel.breadcrumbId")));
|
|
|
map.put("camelContextId", StringUtil.toString(event.getMDC("camel.contextId")));
|
|
|
map.put("body", body);
|
|
|
map.put("fireTimeSource", DateUtil.toStringFormatGMTTime(DateUtil.toGMTTime(event.getTimeStamp()), DateUtil.DEFAULT_TIMESTAMP_FORMAT));
|
|
|
msg.setObject(JSONObject.fromObject(map).toString());
|
|
|
|
|
|
topicPublisher.publish(msg);
|
|
|
} catch (JMSException | RuntimeException e) {
|
|
|
errorHandler.error("Could not publish message in JMSAppender [" + name + "].", e,
|
|
|
ErrorCode.GENERIC_FAILURE);
|
|
|
}
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("exchangeId", StringUtil.toString(event.getMDC("camel.exchangeId")));
|
|
|
map.put("correlationId", StringUtil.toString(event.getMDC("camel.correlationId")));
|
|
|
map.put("transactionKey", StringUtil.toString(event.getMDC("camel.transactionKey")));
|
|
|
map.put("routeId", StringUtil.toString(event.getMDC("camel.routeId")));
|
|
|
map.put("breadcrumbId",StringUtil.toString(event.getMDC("camel.breadcrumbId")));
|
|
|
map.put("camelContextId", StringUtil.toString(event.getMDC("camel.contextId")));
|
|
|
map.put("totalServers", Integer.parseInt(totalServers));
|
|
|
map.put("code", code);
|
|
|
map.put("order", order);
|
|
|
map.put("body", body);
|
|
|
map.put("fireTimeSource", DateUtil.toStringFormatGMTTime(DateUtil.toGMTTime(event.getTimeStamp()), DateUtil.DEFAULT_TIMESTAMP_FORMAT));
|
|
|
msg.setObject(JSONObject.fromObject(map).toString());
|
|
|
topicPublisher.publish(msg);
|
|
|
}
|
|
|
} catch(JMSException | RuntimeException e) {
|
|
|
errorHandler.error("Could not publish message in JMSAppender ["+name+"].", e,
|
|
|
ErrorCode.GENERIC_FAILURE);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|