本文整理汇总了Java中org.apache.camel.spi.RouteContext.setAllowUseOriginalMessage方法的典型用法代码示例。如果您正苦于以下问题:Java RouteContext.setAllowUseOriginalMessage方法的具体用法?Java RouteContext.setAllowUseOriginalMessage怎么用?Java RouteContext.setAllowUseOriginalMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.camel.spi.RouteContext
的用法示例。
在下文中一共展示了RouteContext.setAllowUseOriginalMessage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
import org.apache.camel.spi.RouteContext; //导入方法依赖的package包/类
public void configure(RouteContext routeContext, ErrorHandler handler) {
if (handler instanceof ErrorHandlerSupport) {
ErrorHandlerSupport handlerSupport = (ErrorHandlerSupport) handler;
List<OnExceptionDefinition> list = onExceptions.get(routeContext);
if (list != null) {
for (OnExceptionDefinition exception : list) {
handlerSupport.addExceptionPolicy(routeContext, exception);
}
}
}
if (handler instanceof RedeliveryErrorHandler) {
boolean original = ((RedeliveryErrorHandler) handler).isUseOriginalMessagePolicy();
if (original) {
// ensure allow original is turned on
routeContext.setAllowUseOriginalMessage(true);
}
}
}
示例2: createProcessor
import org.apache.camel.spi.RouteContext; //导入方法依赖的package包/类
@Override
public CatchProcessor createProcessor(RouteContext routeContext) throws Exception {
// load exception classes
if (exceptions != null && !exceptions.isEmpty()) {
exceptionClasses = createExceptionClasses(routeContext.getCamelContext().getClassResolver());
}
if (useOriginalMessagePolicy != null && useOriginalMessagePolicy) {
// ensure allow original is turned on
routeContext.setAllowUseOriginalMessage(true);
}
// must validate configuration before creating processor
validateConfiguration();
Processor childProcessor = this.createChildProcessor(routeContext, false);
Predicate when = null;
if (onWhen != null) {
when = onWhen.getExpression().createPredicate(routeContext);
}
Predicate handle = null;
if (handled != null) {
handle = handled.createPredicate(routeContext);
}
return new CatchProcessor(getExceptionClasses(), childProcessor, when, handle);
}
示例3: createProcessor
import org.apache.camel.spi.RouteContext; //导入方法依赖的package包/类
@Override
public Processor createProcessor(RouteContext routeContext) throws Exception {
// assign whether this was a route scoped onCompletion or not
// we need to know this later when setting the parent, as only route scoped should have parent
// Note: this logic can possible be removed when the Camel routing engine decides at runtime
// to apply onCompletion in a more dynamic fashion than current code base
// and therefore is in a better position to decide among context/route scoped OnCompletion at runtime
if (routeScoped == null) {
routeScoped = super.getParent() != null;
}
boolean isOnCompleteOnly = getOnCompleteOnly() != null && getOnCompleteOnly();
boolean isOnFailureOnly = getOnFailureOnly() != null && getOnFailureOnly();
boolean isParallelProcessing = getParallelProcessing() != null && getParallelProcessing();
boolean original = getUseOriginalMessagePolicy() != null && getUseOriginalMessagePolicy();
if (isOnCompleteOnly && isOnFailureOnly) {
throw new IllegalArgumentException("Both onCompleteOnly and onFailureOnly cannot be true. Only one of them can be true. On node: " + this);
}
if (original) {
// ensure allow original is turned on
routeContext.setAllowUseOriginalMessage(true);
}
String routeId = routeContext.getRoute().idOrCreate(routeContext.getCamelContext().getNodeIdFactory());
Processor childProcessor = this.createChildProcessor(routeContext, true);
// wrap the on completion route in a unit of work processor
CamelInternalProcessor internal = new CamelInternalProcessor(childProcessor);
internal.addAdvice(new CamelInternalProcessor.UnitOfWorkProcessorAdvice(routeContext));
onCompletions.put(routeId, internal);
Predicate when = null;
if (onWhen != null) {
when = onWhen.getExpression().createPredicate(routeContext);
}
boolean shutdownThreadPool = ProcessorDefinitionHelper.willCreateNewThreadPool(routeContext, this, isParallelProcessing);
ExecutorService threadPool = ProcessorDefinitionHelper.getConfiguredExecutorService(routeContext, "OnCompletion", this, isParallelProcessing);
// should be after consumer by default
boolean afterConsumer = mode == null || mode == OnCompletionMode.AfterConsumer;
OnCompletionProcessor answer = new OnCompletionProcessor(routeContext.getCamelContext(), internal,
threadPool, shutdownThreadPool, isOnCompleteOnly, isOnFailureOnly, when, original, afterConsumer);
return answer;
}
示例4: addRoutes
import org.apache.camel.spi.RouteContext; //导入方法依赖的package包/类
public void addRoutes(RouteContext routeContext, Collection<Route> routes) throws Exception {
// assign whether this was a route scoped onException or not
// we need to know this later when setting the parent, as only route scoped should have parent
// Note: this logic can possible be removed when the Camel routing engine decides at runtime
// to apply onException in a more dynamic fashion than current code base
// and therefore is in a better position to decide among context/route scoped OnException at runtime
if (routeScoped == null) {
routeScoped = super.getParent() != null;
}
setHandledFromExpressionType(routeContext);
setContinuedFromExpressionType(routeContext);
setRetryWhileFromExpressionType(routeContext);
setOnRedeliveryFromRedeliveryRef(routeContext);
setOnExceptionOccurredFromOnExceptionOccurredRef(routeContext);
// load exception classes
if (exceptions != null && !exceptions.isEmpty()) {
exceptionClasses = createExceptionClasses(routeContext.getCamelContext().getClassResolver());
}
// must validate configuration before creating processor
validateConfiguration();
if (useOriginalMessagePolicy != null && useOriginalMessagePolicy) {
// ensure allow original is turned on
routeContext.setAllowUseOriginalMessage(true);
}
// lets attach this on exception to the route error handler
Processor child = createOutputsProcessor(routeContext);
if (child != null) {
// wrap in our special safe fallback error handler if OnException have child output
Processor errorHandler = new FatalFallbackErrorHandler(child);
String id = routeContext.getRoute().getId();
errorHandlers.put(id, errorHandler);
}
// lookup the error handler builder
ErrorHandlerBuilder builder = (ErrorHandlerBuilder)routeContext.getRoute().getErrorHandlerBuilder();
// and add this as error handlers
builder.addErrorHandlers(routeContext, this);
}