当前位置: 首页>>代码示例>>Java>>正文


Java Tracer类代码示例

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


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


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