本文整理汇总了Java中org.apache.camel.LoggingLevel类的典型用法代码示例。如果您正苦于以下问题:Java LoggingLevel类的具体用法?Java LoggingLevel怎么用?Java LoggingLevel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LoggingLevel类属于org.apache.camel包,在下文中一共展示了LoggingLevel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRouteBuilder
import org.apache.camel.LoggingLevel; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
errorHandler(deadLetterChannel("mock:global")
.maximumRedeliveries(2)
.redeliveryDelay(5000));
from("direct:start")
// no redelivery delay for faster unit tests
.onException(ConnectException.class).maximumRedeliveries(5).redeliveryDelay(0)
.logRetryAttempted(true).retryAttemptedLogLevel(LoggingLevel.WARN)
// send to mock when we are exhausted
.to("mock:exhausted")
.end()
.to("seda:foo");
}
};
}
示例2: configure
import org.apache.camel.LoggingLevel; //导入依赖的package包/类
@Override
public void configure() throws Exception {
// no problems
from("flowable:ErrorHandling:NormalExecution").routeId("outbound").log(LoggingLevel.INFO, "Normal execution").to("seda:inbound");
// always fails with default error handling: propagates exception back
// to the caller
from("flowable:ErrorHandling:ProvokeError").routeId("error").log(LoggingLevel.INFO, "Provoked error").bean("brokenService") // <--
// throws
// Exception
.to("seda:inbound");
// always fails with specific error handler: exception is not propagated
// back
from("flowable:ErrorHandling:HandleError").routeId("errorWithDlq").errorHandler(deadLetterChannel("seda:dlq")).log(LoggingLevel.INFO, "Provoked error").bean("brokenService") // <--
// throws
// Exception
.to("seda:inbound");
}
示例3: configure
import org.apache.camel.LoggingLevel; //导入依赖的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);
}
示例4: createRouteBuilder
import org.apache.camel.LoggingLevel; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
// START SNIPPET: e1
// this error handler will try up till 20 redelivery attempts with 1 second between.
// however if we are stopping then do not allow any redeliver attempts.
errorHandler(defaultErrorHandler()
.allowRedeliveryWhileStopping(false)
.maximumRedeliveries(20).redeliveryDelay(1000).retryAttemptedLogLevel(LoggingLevel.INFO));
from("seda:foo").routeId("foo")
.to("mock:foo")
.throwException(new IllegalArgumentException("Forced"));
// END SNIPPET: e1
}
};
}
示例5: createRouteBuilder
import org.apache.camel.LoggingLevel; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
onException(Exception.class)
.maximumRedeliveries(REDELIVERY_COUNT)
.retryAttemptedLogLevel(LoggingLevel.INFO)
.retriesExhaustedLogLevel(LoggingLevel.ERROR)
// lets have a little delay so we do async redelivery
.redeliveryDelay(10)
.to("mock:exception")
.handled(true);
from("direct:start")
.routeId("start")
.to("netty4:tcp://localhost:" + port)
.to("log:downstream")
.to("mock:downstream");
}
};
}
示例6: testConsumptionCompletionSize
import org.apache.camel.LoggingLevel; //导入依赖的package包/类
@Test
public void testConsumptionCompletionSize() throws Exception {
final int completionSize = 5;
final int completionTimeout = -1; // size-based only
final String queueName = getQueueName();
context.addRoutes(new TransactedSendHarness(queueName));
context.addRoutes(new RouteBuilder() {
public void configure() throws Exception {
fromF("sjms-batch:%s?completionTimeout=%s&completionSize=%s&aggregationStrategy=#testStrategy",
queueName, completionTimeout, completionSize).routeId("batchConsumer").startupOrder(10)
.log(LoggingLevel.DEBUG, "${body.size}")
.to("mock:batches");
}
});
context.start();
int messageCount = 100;
MockEndpoint mockBatches = getMockEndpoint("mock:batches");
mockBatches.expectedMessageCount(messageCount / completionSize);
template.sendBody("direct:in", generateStrings(messageCount));
mockBatches.assertIsSatisfied();
}
示例7: testLoggingErrorHandler5
import org.apache.camel.LoggingLevel; //导入依赖的package包/类
public void testLoggingErrorHandler5() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
errorHandler(loggingErrorHandler().level(LoggingLevel.ERROR).logName("foo"));
from("direct:start").to("mock:foo").throwException(new IllegalArgumentException("Damn"));
}
});
context.start();
try {
template.sendBody("direct:start", "Hello World");
fail("Should have thrown an exception");
} catch (Exception e) {
// expected
}
}
示例8: configure
import org.apache.camel.LoggingLevel; //导入依赖的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);
}
示例9: createRouteBuilder
import org.apache.camel.LoggingLevel; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() {
getContext().addInterceptStrategy(new HandleFault());
errorHandler(
deadLetterChannel("mock:error")
.maximumRedeliveries(4)
.loggingLevel(LoggingLevel.DEBUG));
from("direct:start")
.to("mock:a")
.process(successOnRetryProcessor)
.to("mock:b");
}
};
}
示例10: createRouteBuilder
import org.apache.camel.LoggingLevel; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
onException(IllegalArgumentException.class)
.handled(true)
.to("mock:handled");
from("seda:a")
.errorHandler(deadLetterChannel("mock:dead.a")
.maximumRedeliveries(3).redeliveryDelay(0)
.retryAttemptedLogLevel(LoggingLevel.WARN).asyncDelayedRedelivery())
.to("mock:a")
.throwException(new IllegalArgumentException("Forced A"));
from("seda:b")
.errorHandler(deadLetterChannel("mock:dead.b")
.maximumRedeliveries(2).redeliveryDelay(0)
.retryAttemptedLogLevel(LoggingLevel.WARN))
.to("mock:b")
.throwException(new IOException("Some IO error"));
}
};
}
示例11: testLoggingErrorHandler2
import org.apache.camel.LoggingLevel; //导入依赖的package包/类
public void testLoggingErrorHandler2() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
errorHandler(loggingErrorHandler().level(LoggingLevel.WARN).log(LoggerFactory.getLogger("foo")));
from("direct:start").to("mock:foo").throwException(new IllegalArgumentException("Damn"));
}
});
context.start();
try {
template.sendBody("direct:start", "Hello World");
fail("Should have thrown an exception");
} catch (Exception e) {
// expected
}
}
示例12: createRouteBuilder
import org.apache.camel.LoggingLevel; //导入依赖的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");
}
};
}
示例13: configure
import org.apache.camel.LoggingLevel; //导入依赖的package包/类
@SuppressWarnings("el-syntax")
@Override
public void configure() throws Exception {
from("netty4-http:http://0.0.0.0:9090/produceJmsMessage")
.routeId("jms-message-producer-route")
.streamCaching()
.setProperty("start", simple("${date:now:YYYYMMDD HH:mm:ss.SSS}"))
.filter(header("destination").isNull())
.transform().method("informationBean","transactedUsage()")
.stop()
.end()
.process("jmsSendPropertiesProcessor") // Prepare JMS Send Properties
.log(LoggingLevel.INFO,
"Publishing ${exchangeProperty.messageCount} messages...")
.setExchangePattern(ExchangePattern.InOnly)
.loopDoWhile(simple("${exchangeProperty.messageCount} > 0"))
.process("jmsTransactionBatchProcessor") // Prepare Transaction Batch to send
.log(LoggingLevel.INFO,
"Batch size: ${exchangeProperty.transactionBatchSize} - [${exchangeProperty.sjmsUri}]")
.recipientList(exchangeProperty("sjmsUri")).end()
.end()
.setProperty("end", simple("${date:now:YYYYMMDD HH:mm:ss.SSS}"))
.setProperty("duration").method("informationBean",
"getDuration(${exchangeProperty.start},${exchangeProperty.end})")
.log(LoggingLevel.INFO,
"Publishing ${exchangeProperty.messageToSend} messages DONE in ${exchangeProperty.duration}")
.setExchangePattern(ExchangePattern.InOut)
.process("prepareHttpResponseProcessor");
}
示例14: handle
import org.apache.camel.LoggingLevel; //导入依赖的package包/类
@Override
public Optional<ProcessorDefinition> handle(Log step, ProcessorDefinition route, SyndesisRouteBuilder routeBuilder) {
LoggingLevel loggingLevel = LoggingLevel.INFO;
if (step.getLoggingLevel() != null) {
loggingLevel = LoggingLevel.valueOf(step.getLoggingLevel());
}
return Optional.of(route.log(loggingLevel, step.getLogger(), step.getMarker(), step.getMessage()));
}
示例15: route
import org.apache.camel.LoggingLevel; //导入依赖的package包/类
@Bean
@Override
public RouteBuilder route() {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
// @formatter:off
from("direct:test").routeId("spongeProducer")
.to("sponge:spongeEngine")
.log("Sent event: ${body}");
from("direct:log").routeId("directLog")
.log("${body}");
from("direct:error").routeId("directError")
.log(LoggingLevel.ERROR, "Received message on direct:error endpoint.");
from("direct:end").routeId("directEnd")
.log("Received message on direct:end endpoint: ${body}");
from("sponge:spongeEngine").routeId("spongeConsumer")
.log("Received message on direct:consumerEnd endpoint: ${body}");
// @formatter:on
}
};
}