javaduke commented on a change in pull request #6535:
URL: https://github.com/apache/camel/pull/6535#discussion_r768964974
##########
File path:
core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedBacklogDebugger.java
##########
@@ -274,4 +283,77 @@ public long getFallbackTimeout() {
public void setFallbackTimeout(long fallbackTimeout) {
backlogDebugger.setFallbackTimeout(fallbackTimeout);
}
+
+ @Override
+ public String dumpExchangePropertiesAsXml(String id) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("<properties>");
+ Exchange suspendedExchange = backlogDebugger.getSuspendedExchange(id);
+ if (suspendedExchange != null) {
+ Map<String, Object> properties =
suspendedExchange.getAllProperties();
+ properties.forEach((propertyName, propertyValue) -> {
+ String type = ObjectHelper.classCanonicalName(propertyValue);
+ sb.append("<property
name=\"").append(propertyName).append("\"");
+ if (type != null) {
+ sb.append(" type=\"").append(type).append("\"");
+ }
+ sb.append(">");
+ // dump property value as XML, use Camel type converter to
convert
+ // to String
+ if (propertyValue != null) {
+ try {
+ String xml =
suspendedExchange.getContext().getTypeConverter().tryConvertTo(String.class,
+ suspendedExchange, propertyValue);
+ if (xml != null) {
+ // must always xml encode
+ sb.append(StringHelper.xmlEncode(xml));
+ }
+ } catch (Throwable e) {
+ // ignore as the body is for logging purpose
+ }
+ }
+ sb.append("</property>\n");
+ });
+ }
+ sb.append("</properties>");
+ return sb.toString();
+ }
+
+ @Override
+ public String evaluateExpressionAtBreakpoint(String id, String language,
String expression) {
+ return evaluateExpressionAtBreakpoint(id, language, expression,
"java.lang.String").toString();
+ }
+
+ @Override
+ public Object evaluateExpressionAtBreakpoint(String id, String language,
String expression, String resultType) {
+ Exchange suspendedExchange = null;
+ try {
+ Language lan = camelContext.resolveLanguage(language);
+ suspendedExchange = backlogDebugger.getSuspendedExchange(id);
+ if (suspendedExchange != null) {
+ Object result = null;
+ Class resultClass = Class.forName(resultType);
Review comment:
thanks, fixed!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]