Class OnExceptionDefinition
Scope-opener definition for route-level exception handling.
Wraps the child pipeline with an that
retries, handles, or continues on the configured exception types.
Configure redelivery settings with ,
, etc., then close with or
. Inherits the leaf DSL from ;
child steps build the handler body.
public class OnExceptionDefinition : RouteDefinitionBase<OnExceptionDefinition>, IRouteDefinition, IProcessorDefinition, IRouteScope
Inheritance
Implements
Inherited Members
Properties
BackoffMultiplierValue
Backoff multiplier applied to the delay after each retry.
public double BackoffMultiplierValue { get; }
ExceptionTypes
Exception types this handler applies to.
public IReadOnlyList<Type> ExceptionTypes { get; }
IsContinued
Whether exchange processing continues after the handler runs.
public bool IsContinued { get; }
IsHandled
Whether the exception is marked as handled (suppresses propagation).
public bool IsHandled { get; }
IsUseOriginalBody
Whether the original body restoration is enabled.
public bool IsUseOriginalBody { get; }
LogStackTraceValue
Current LogStackTrace value (default true).
public bool LogStackTraceValue { get; }
OnExceptionOccurredAction
Optional exception-occurred callback.
public Action<IExchange>? OnExceptionOccurredAction { get; }
OnExceptionOccurredProcessor
Optional exception-occurred processor.
public IProcessor? OnExceptionOccurredProcessor { get; }
OnPrepareFailureAction
Optional pre-failure callback.
public Action<IExchange>? OnPrepareFailureAction { get; }
OnPrepareFailureProcessor
Optional pre-failure processor.
public IProcessor? OnPrepareFailureProcessor { get; }
OnRedeliveryAction
Optional redelivery callback.
public Action<IExchange>? OnRedeliveryAction { get; }
OnRedeliveryProcessor
Optional redelivery processor.
public IProcessor? OnRedeliveryProcessor { get; }
OnWhenPredicate
Optional predicate gating handler activation.
public Func<IExchange, bool>? OnWhenPredicate { get; }
RedeliveryDelayValue
Delay between retry attempts (null = default 1 second). Inspection accessor.
public TimeSpan? RedeliveryDelayValue { get; }
RetriesExhaustedLogLevelValue
Log level used when retries are exhausted (default Error).
public LogLevel RetriesExhaustedLogLevelValue { get; }
RetryAttemptedLogLevelValue
Log level for retry-attempt log entries (default Debug).
public LogLevel RetryAttemptedLogLevelValue { get; }
RetryWhilePredicate
Optional predicate controlling retry continuation.
public Func<IExchange, bool>? RetryWhilePredicate { get; }
UseExponentialBackoffValue
Whether exponential backoff is enabled.
public bool UseExponentialBackoffValue { get; }
Methods
BackoffMultiplier(double)
Apache Camel alias for .
public OnExceptionDefinition BackoffMultiplier(double multiplier)
BackOffMultiplier(double)
Sets the backoff multiplier applied to the delay after each retry.
public OnExceptionDefinition BackOffMultiplier(double multiplier)
Continued(bool)
Suppresses the failure and picks the route up at the step after the one that failed (Apache Camel's
public OnExceptionDefinition Continued(bool value = true)
CreateProcessor(IRouteContext)
Compile this node into a runtime processor.
public override IProcessor CreateProcessor(IRouteContext context)
EndOnException()
Closes this OnException scope and returns the parent route definition.
public IRouteDefinition EndOnException()
Handled(bool)
Marks the exception as handled (suppresses further propagation).
public OnExceptionDefinition Handled(bool value = true)
LogContinued(bool)
Whether the exhausted-failure log entry is written for a failure the handler continued (default: false, as in Camel).
public OnExceptionDefinition LogContinued(bool value = true)
LogExhausted(bool)
Whether to emit a log entry when retries are exhausted (default: true).
public OnExceptionDefinition LogExhausted(bool value = true)
LogHandled(bool)
Whether the exhausted-failure log entry is written for a failure the handler handled (default: false, as in Camel).
public OnExceptionDefinition LogHandled(bool value = true)
LogStackTrace(bool)
Whether to include the full stack trace in retry log messages (default: true).
public OnExceptionDefinition LogStackTrace(bool value = true)
MaximumRedeliveries(int)
Sets the maximum number of redelivery attempts.
public OnExceptionDefinition MaximumRedeliveries(int count)
OnExceptionOccurred(Action<IExchange>)
Callback invoked when the exception occurs (before any retry).
public OnExceptionDefinition OnExceptionOccurred(Action<IExchange> action)
OnExceptionOccurred(IProcessor)
Processor invoked every time the exception occurs, before any retry (Apache Camel's onExceptionOccurred).
public OnExceptionDefinition OnExceptionOccurred(IProcessor processor)
OnPrepareFailure(Action<IExchange>)
Callback invoked when the handler itself fails.
public OnExceptionDefinition OnPrepareFailure(Action<IExchange> action)
OnPrepareFailure(IProcessor)
Processor invoked before the handler runs, once the redeliveries are exhausted (Apache Camel's
public OnExceptionDefinition OnPrepareFailure(IProcessor processor)
OnRedelivery(Action<IExchange>)
Callback invoked on each redelivery attempt.
public OnExceptionDefinition OnRedelivery(Action<IExchange> action)
OnRedelivery(IProcessor)
Processor invoked before each redelivery attempt (Apache Camel's onRedelivery).
public OnExceptionDefinition OnRedelivery(IProcessor processor)
OnWhen(Func<IExchange, bool>)
Conditional predicate — only handle when predicate returns true.
public OnExceptionDefinition OnWhen(Func<IExchange, bool> predicate)
OnWhen(IPredicate)
Conditional predicate as an (Header("retryable").isEqualTo("true")).
public OnExceptionDefinition OnWhen(IPredicate predicate)
OnWhen(string)
Conditional predicate written as a route expression, the spelling a declarative route
public OnExceptionDefinition OnWhen(string condition)
RedeliveryDelay(TimeSpan)
Sets the delay between retry attempts.
public OnExceptionDefinition RedeliveryDelay(TimeSpan delay)
RedeliveryPolicy(RedeliveryPolicy)
Applies all settings from a pre-built .
public OnExceptionDefinition RedeliveryPolicy(RedeliveryPolicy policy)
RetriesExhaustedLogLevel(LogLevel)
Log level used when retries are exhausted.
public OnExceptionDefinition RetriesExhaustedLogLevel(LogLevel level)
RetryAttemptedLogLevel(LogLevel)
Log level used for retry-attempt log entries.
public OnExceptionDefinition RetryAttemptedLogLevel(LogLevel level)
RetryWhile(Func<IExchange, bool>)
Retry while the predicate returns true.
public OnExceptionDefinition RetryWhile(Func<IExchange, bool> predicate)
RetryWhile(IPredicate)
Retry while the holds.
public OnExceptionDefinition RetryWhile(IPredicate predicate)
RetryWhile(string)
Retry while the route expression holds — the string form of .
public OnExceptionDefinition RetryWhile(string condition)
UseExponentialBackoff(bool)
Apache Camel alias for .
public OnExceptionDefinition UseExponentialBackoff(bool value = true)
UseExponentialBackOff(bool)
Enables (or disables) exponential backoff between retries.
public OnExceptionDefinition UseExponentialBackOff(bool value = true)
UseOriginalBody()
Marks that the original (pre-exception) body should be restored for the handler.
public OnExceptionDefinition UseOriginalBody()