• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Tracer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.camel.processor.interceptor.Tracer的典型用法代码示例。如果您正苦于以下问题:Java Tracer类的具体用法?Java Tracer怎么用?Java Tracer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Tracer类属于org.apache.camel.processor.interceptor包,在下文中一共展示了Tracer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: start

import org.apache.camel.processor.interceptor.Tracer; //导入依赖的package包/类
@Override
public void start() throws Exception {
    ObjectHelper.notNull(camelContext, "CamelContext", this);

    // register our event notifier
    ServiceHelper.startService(debugEventNotifier);
    camelContext.getManagementStrategy().addEventNotifier(debugEventNotifier);

    if (isUseTracer()) {
        Tracer tracer = Tracer.getTracer(camelContext);
        if (tracer == null) {
            // tracer is disabled so enable it silently so we can leverage it to trace the Exchanges for us
            tracer = Tracer.createTracer(camelContext);
            tracer.setLogLevel(LoggingLevel.OFF);
            camelContext.addService(tracer);
            camelContext.addInterceptStrategy(tracer);
        }
        // make sure tracer is enabled so the debugger can leverage the tracer for debugging purposes
        tracer.setEnabled(true);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:22,代码来源:DefaultDebugger.java


示例2: createRouteBuilder

import org.apache.camel.processor.interceptor.Tracer; //导入依赖的package包/类
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        public void configure() throws Exception {
            // START SNIPPET: tracingOutExchanges
            Tracer tracer = new Tracer();
            tracer.setTraceOutExchanges(true);

            // we configure the default trace formatter where we can
            // specify which fields we want in the output
            DefaultTraceFormatter formatter = new DefaultTraceFormatter();
            formatter.setShowOutBody(true);
            formatter.setShowOutBodyType(true);

            // set to use our formatter
            tracer.setFormatter(formatter);
            
            getContext().addInterceptStrategy(tracer);
            // END SNIPPET: tracingOutExchanges
            
            from("direct:start").
                transform().body().
                to("mock:a").
                to("mock:b");
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:27,代码来源:TraceInterceptorWithOutBodyTraceTest.java


示例3: createRouteBuilder

import org.apache.camel.processor.interceptor.Tracer; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            Tracer tracer = new Tracer();
            tracer.setDestinationUri("mock:trace");
            context.addInterceptStrategy(tracer);

            // START SNIPPET: e1
            // define a global on completion that is invoked when the exchange is complete
            onCompletion().to("log:global").to("mock:sync");

            from("direct:start")
                .process("myProcessor")
                .to("mock:result");
            // END SNIPPET: e1
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:OnCompletionGlobalTraceTest.java


示例4: createRouteBuilder

import org.apache.camel.processor.interceptor.Tracer; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            Tracer tracer = new Tracer();
            tracer.setDestinationUri("mock:trace");
            context.addInterceptStrategy(tracer);

            intercept().to("mock:intercepted");

            from("direct:start")
                .to("mock:foo").to("mock:bar").to("mock:result");
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:InterceptSimpleRouteTraceTest.java


示例5: createRouteBuilder

import org.apache.camel.processor.interceptor.Tracer; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            Tracer tracer = new Tracer();
            tracer.setDestinationUri("mock:traced");
            tracer.setLogName("foo");
            context.addInterceptStrategy(tracer);

            from("direct:a").to("mock:a");

            from("direct:b").noTracing().to("mock:b");

            from("direct:c").tracing().to("mock:c");
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:TracePerRouteTest.java


示例6: createRouteBuilder

import org.apache.camel.processor.interceptor.Tracer; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            Tracer tracer = new Tracer();
            tracer.setDestinationUri("mock:traced");
            tracer.setLogLevel(LoggingLevel.OFF);
            context.addInterceptStrategy(tracer);

            from("direct:start").to("log:foo").to("mock:result");

            from("direct:foo").noTracing().to("mock:foo");
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:ManagedRouteContextTracerTest.java


示例7: createRouteBuilder

import org.apache.camel.processor.interceptor.Tracer; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            Tracer tracer = new Tracer();
            getContext().addInterceptStrategy(tracer);
            
            from("file:target/split").routeId("foo").noAutoStartup()
                .split(body().tokenize(comma))
                    .parallelProcessing()
                    .streaming()
                    .setProperty("split", new SimpleExpression("${property.CamelSplitIndex}"))
                    .split(body().tokenize(LS))
                        .parallelProcessing()
                        .streaming()
                        .setBody(body().append(":Status=OK").append(LS))
                        .to("file:target/split/outbox?fileExist=Append&fileName=result${property.split}.txt")
                   .end()
                   .setBody(new SimpleExpression("${property.split} complete"))
                   .to("file:target/split/outbox?fileExist=Append&fileName=result${property.split}.txt")
                .end().to("mock:result");

        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:27,代码来源:FileSplitInSplitTest.java


示例8: createRouteBuilder

import org.apache.camel.processor.interceptor.Tracer; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            getContext().addInterceptStrategy(new Tracer());

            from(getFtpUrl()).process(new Processor() {
                public void process(Exchange exchange) throws Exception {
                    assertNotNull(exchange.getIn().getHeader(Exchange.FILE_NAME));
                    assertEquals("hello.txt", exchange.getIn().getHeader(Exchange.FILE_NAME_ONLY));
                    assertEquals("Hello World", exchange.getIn().getBody(String.class));
                }
            }).to("mock:result");
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:PaddyRouteTest.java


示例9: configure

import org.apache.camel.processor.interceptor.Tracer; //导入依赖的package包/类
public void configure() {

            Tracer tracer = new Tracer();
            tracer.setLogLevel(LoggingLevel.ERROR);
            tracer.setLogName("org.apache.camel.bindy");

            getContext().addInterceptStrategy(tracer);

            // default should errors go to mock:error
            errorHandler(deadLetterChannel(URI_MOCK_ERROR).redeliveryDelay(0));

            onException(Exception.class).maximumRedeliveries(0).handled(true);

            BindyDataFormat bindy = new BindyDataFormat();
            bindy.setLocale("en");
            bindy.setClassType(Order.class);
            bindy.setType(BindyType.Fixed);

            from(URI_DIRECT_START)
                    .marshal(bindy)
                    .to(URI_MOCK_RESULT);
        }
 
开发者ID:HydAu,项目名称:Camel,代码行数:23,代码来源:BindySimpleFixedLengthMarshallTest.java


示例10: route

import org.apache.camel.processor.interceptor.Tracer; //导入依赖的package包/类
@Bean
@Override
public RouteBuilder route() {
    return new RouteBuilder() {
        public void configure() {
            Tracer tracer = new Tracer();
            tracer.setLogLevel(LoggingLevel.ERROR);
            tracer.setLogName("org.apache.camel.bindy");
            getContext().addInterceptStrategy(tracer);

            // default should errors go to mock:error
            errorHandler(deadLetterChannel(URI_MOCK_ERROR).redeliveryDelay(0));

            onException(Exception.class).maximumRedeliveries(0).handled(true);

            BindyDataFormat bindy = new BindyDataFormat();
            bindy.setLocale("en");
            bindy.setClassType(Order.class);
            bindy.setType(BindyType.Fixed);

            from(URI_DIRECT_START)
                    .marshal(bindy)
                    .to(URI_MOCK_RESULT);
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:27,代码来源:BindySimpleFixedLengthObjectMarshallTest.java


示例11: configure

import org.apache.camel.processor.interceptor.Tracer; //导入依赖的package包/类
public void configure() {

            Tracer tracer = new Tracer();
            tracer.setLogLevel(LoggingLevel.ERROR);
            tracer.setLogName("org.apache.camel.bindy");
            tracer.setLogStackTrace(true);
            tracer.setTraceExceptions(true);

            getContext().addInterceptStrategy(tracer);

            // default should errors go to mock:error
            errorHandler(deadLetterChannel(URI_MOCK_ERROR));

            onException(IllegalArgumentException.class).maximumRedeliveries(0).handled(true);

            from(URI_DIRECT_START).marshal(orderBindyDataFormat).to(URI_MOCK_RESULT);
        }
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:BindySimpleKeyValuePairWithoutSectionMarshallDslTest.java


示例12: configure

import org.apache.camel.processor.interceptor.Tracer; //导入依赖的package包/类
public void configure() {
    BindyCsvDataFormat camelDataFormat = 
        new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclass.Order.class);
    camelDataFormat.setLocale("en");

    Tracer tracer = new Tracer();
    tracer.setLogLevel(LoggingLevel.ERROR);
    tracer.setLogName("org.apache.camel.bindy");

    getContext().addInterceptStrategy(tracer);

    // default should errors go to mock:error
    errorHandler(deadLetterChannel(URI_MOCK_ERROR).redeliveryDelay(0));

    onException(Exception.class).maximumRedeliveries(0).handled(true);

    from(URI_DIRECT_START).marshal(camelDataFormat).to(URI_MOCK_RESULT);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:BindyPojoSimpleCsvMarshallTest.java


示例13: testTracerExceptionInOut

import org.apache.camel.processor.interceptor.Tracer; //导入依赖的package包/类
public void testTracerExceptionInOut() throws Exception {
    MockEndpoint result = getMockEndpoint("mock:result");
    ((Tracer) context.getDefaultTracer()).setTraceOutExchanges(true);
    result.expectedMessageCount(3);
    prepareTestTracerExceptionInOut();

    template.sendBody("direct:start", "Hello World");
    template.sendBody("direct:start", "Bye World");
    try {
        template.sendBody("direct:start", "Kaboom");
        fail("Should have thrown exception");
    } catch (Exception e) {
        // expected
    }
    template.sendBody("direct:start", "Hello Camel");

    assertMockEndpointsSatisfied();

    validateTestTracerExceptionInOut();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:TracingTestBase.java


示例14: createContextWithGivenRoute

import org.apache.camel.processor.interceptor.Tracer; //导入依赖的package包/类
protected void createContextWithGivenRoute(RouteBuilder route, int timeWork) throws Exception, InterruptedException {
    SimpleRegistry registry = new SimpleRegistry();
    ModelCamelContext context = new DefaultCamelContext(registry);
    Tracer tracer = new Tracer();
    tracer.setLogName("MyTracerLog");
    tracer.getDefaultTraceFormatter().setShowProperties(false);
    tracer.getDefaultTraceFormatter().setShowHeaders(false);
    tracer.getDefaultTraceFormatter().setShowBody(true);
    context.addInterceptStrategy(tracer);
    context.addRoutes(route);
    context.addComponent("activeMq", activeMq);

    this.camelContext = context;
    this.ct = context.createConsumerTemplate();
    this.pt = context.createProducerTemplate();

    context.start();
    context.setTracing(false);
    Thread.sleep(timeWork);
    context.stop();
}
 
开发者ID:przodownikR1,项目名称:cxf_over_jms_kata,代码行数:22,代码来源:CommonCreateCamelContext.java


示例15: configure

import org.apache.camel.processor.interceptor.Tracer; //导入依赖的package包/类
@Override
public void configure() throws Exception {
    getContext().setTracing(true);

    Tracer tracer = new Tracer();
    tracer.setLogName("MyTracerLog");

    tracer.getDefaultTraceFormatter().setShowProperties(true);
    tracer.getDefaultTraceFormatter().setShowHeaders(false);

    getContext().addInterceptStrategy(tracer);

    from("direct:start")
        .setBody(simple("Tracing ${body}"))
        .to("mock:result");
}
 
开发者ID:CamelCookbook,项目名称:camel-cookbook-examples,代码行数:17,代码来源:TraceRouteBuilder.java


示例16: addInterceptStrategy

import org.apache.camel.processor.interceptor.Tracer; //导入依赖的package包/类
public void addInterceptStrategy(InterceptStrategy interceptStrategy) {
    getInterceptStrategies().add(interceptStrategy);

    // for backwards compatible or if user add them here instead of the setXXX methods

    if (interceptStrategy instanceof Tracer) {
        setTracing(true);
    } else if (interceptStrategy instanceof HandleFault) {
        setHandleFault(true);
    } else if (interceptStrategy instanceof StreamCaching) {
        setStreamCaching(true);
    } else if (interceptStrategy instanceof Delayer) {
        setDelayer(((Delayer)interceptStrategy).getDelay());
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:16,代码来源:DefaultCamelContext.java


示例17: createRouteBuilder

import org.apache.camel.processor.interceptor.Tracer; //导入依赖的package包/类
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            getContext().addInterceptStrategy(new Tracer());
            
            from("direct:beanRef").bean("myBean", "route");
            from("direct:recipientList").recipientList().method("myBean", "recipientList");

            from("direct:a").transform(constant("Hello a")).to("mock:a");
            from("direct:b").transform(constant("Hello b")).to("mock:b");
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:14,代码来源:RecipientListReturnValueTest.java


示例18: createRouteBuilder

import org.apache.camel.processor.interceptor.Tracer; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            Tracer tracer = new Tracer();
            tracer.setDestinationUri("mock:trace");
            context.addInterceptStrategy(tracer);

            onException(IllegalArgumentException.class).handled(true).to("log:boom").to("mock:boom");

            from("direct:start").process("myProcessor").to("mock:result");
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:16,代码来源:DefaultErrorHandlerOnExceptionTraceTest.java


示例19: createRouteBuilder

import org.apache.camel.processor.interceptor.Tracer; //导入依赖的package包/类
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        public void configure() throws Exception {
            Tracer tracer = new Tracer();
            tracer.setLogLevel(LoggingLevel.ERROR);
            tracer.setLogName("com.mycompany");

            getContext().addInterceptStrategy(tracer);

            from("direct:start").to("mock:result");
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:14,代码来源:TracerConfigurationTest.java


示例20: createCamelContext

import org.apache.camel.processor.interceptor.Tracer; //导入依赖的package包/类
@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext contextLocal = super.createCamelContext();

    Tracer tracer = (Tracer) contextLocal.getDefaultTracer();
    tracer.setEnabled(true);
    tracer.getTraceHandlers().clear();
    tracer.getTraceHandlers().add(new MyTraceHandler());
    tracer.setTraceOutExchanges(true);

    return contextLocal;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:AsyncTraceHandlerTest.java



注:本文中的org.apache.camel.processor.interceptor.Tracer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JspPropertyGroup类代码示例发布时间:2022-05-22
下一篇:
Java Utils类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap