微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

org.apache.camel.processor.DefaultExchangeFormatter的实例源码

项目:Camel    文件DefaultExchangeFormatterTest.java   
public void testConfiguration() {
    DefaultExchangeFormatter formatter = new DefaultExchangeFormatter();

    assertFalse(formatter.isShowExchangeId());
    assertFalse(formatter.isShowProperties());
    assertFalse(formatter.isShowHeaders());
    assertTrue(formatter.isShowBodyType());
    assertTrue(formatter.isShowBody());
    assertFalse(formatter.isShowOut());
    assertFalse(formatter.isShowException());
    assertFalse(formatter.isShowCaughtException());
    assertFalse(formatter.isShowStackTrace());
    assertFalse(formatter.isShowAll());
    assertFalse(formatter.isMultiline());
    assertEquals(10000,formatter.getMaxChars());
}
项目:Camel    文件DefaultAsyncProcessorAwaitManager.java   
public DefaultAsyncProcessorAwaitManager() {
    // setup exchange formatter to be used for message history dump
    DefaultExchangeFormatter formatter = new DefaultExchangeFormatter();
    formatter.setShowExchangeId(true);
    formatter.setMultiline(true);
    formatter.setShowHeaders(true);
    formatter.setStyle(DefaultExchangeFormatter.OutputStyle.Fixed);
    this.exchangeFormatter = formatter;
}
项目:cLeverbus    文件AbstractBasicRoute.java   
protected AbstractBasicRoute() {
    // setup exchange formatter to be used for message history dump
    historyFormatter = new DefaultExchangeFormatter();
    historyFormatter.setShowExchangeId(true);
    historyFormatter.setMultiline(true);
    historyFormatter.setShowHeaders(true);
    historyFormatter.setStyle(DefaultExchangeFormatter.OutputStyle.Fixed);
}
项目:Camel    文件ExpressionBuilder.java   
/**
 * Returns the message history (including exchange details or not)
 */
public static Expression messageHistoryExpression(final boolean detailed) {
    return new ExpressionAdapter() {

        private ExchangeFormatter formatter;

        public Object evaluate(Exchange exchange) {
            ExchangeFormatter ef = null;
            if (detailed) {
                // use the exchange formatter to log exchange details
                ef = getorCreateExchangeFormatter(exchange.getContext());
            }
            return MessageHelper.dumpMessageHistoryStacktrace(exchange,ef,false);
        }

        private ExchangeFormatter getorCreateExchangeFormatter(CamelContext camelContext) {
            if (formatter == null) {
                Set<ExchangeFormatter> formatters = camelContext.getRegistry().findByType(ExchangeFormatter.class);
                if (formatters != null && formatters.size() == 1) {
                    formatter = formatters.iterator().next();
                } else {
                    // setup exchange formatter to be used for message history dump
                    DefaultExchangeFormatter def = new DefaultExchangeFormatter();
                    def.setShowExchangeId(true);
                    def.setMultiline(true);
                    def.setShowHeaders(true);
                    def.setStyle(DefaultExchangeFormatter.OutputStyle.Fixed);
                    try {
                        Integer maxChars = CamelContextHelper.parseInteger(camelContext,camelContext.getProperty(Exchange.LOG_DEBUG_BODY_MAX_CHARS));
                        if (maxChars != null) {
                            def.setMaxChars(maxChars);
                        }
                    } catch (Exception e) {
                        throw ObjectHelper.wrapRuntimeCamelException(e);
                    }
                    formatter = def;
                }
            }
            return formatter;
        }

        @Override
        public String toString() {
            return "messageHistory(" + detailed + ")";
        }
    };
}
项目:jboss-fuse-examples    文件ExampleThreading.java   
public void logMessageHistory(Exchange exchange) {
    LOG.info(MessageHelper.dumpMessageHistoryStacktrace(exchange,new DefaultExchangeFormatter(),false));
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。