Search code examples
apache-camelspring-camel

handled tag in spring-camel 3.0 xml is deprecated


Facing an issue while migrating from 2.x version to 3.16.0. What is the alternative for <handled><constant>true</constant></handled> in camel-spring 3.x versions.

What is the alternative for handled and continue in higher versions?


Solution

  • The handled tag is not deprecated as you can see in the class OnExceptionDefinition corresponding to the model class that is used to generate the XSD schema of the Spring XML DSL and in the latest XSD schema.

    The equivalent of your code in Spring XML DSL is:

    <onException>
        <!-- the exception is full qualified names as plain strings -->
        <!-- there can be more just add a 2nd, 3rd exception element (unbounded) -->
        <exception>java. Lang. Throwable</exception>
        <!-- mark this as handled -->
        <handled>
            <constant>true</constant>
        </handled>
        ...
    </onException>
    

    For more details about error handling using Spring DSL please refer to the documentation.