Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-7492

xpath/xquery - Allow to suppress exceptions when used as predicate

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • None
    • Future
    • camel-core, camel-saxon
    • None
    • Unknown

    Description

      See
      http://stackoverflow.com/questions/24124015/apache-camel-xpath-routing

      If you use a content based router, and have different kind of xml coming in, you may want to ignore any exceptions, if a < xpath > expression fails to evaluate as the xml does not fit that format.

      So if we have

         <xpath ignoreException="true">/foo/bar</xpath>
      

      eg a new attribute to set a flag to ignore exceptions. Though naming is hard, so maybe there is a better name for the attribute.

      Related is also the validate eip, but I dont think we can use that as an expression/predicate: http://camel.apache.org/validate

      Otherwise we could do something like this; which may be even better as then it works with any Camel expression/predicate.

      <choice>
         <when><validate><xpath>/foo/bar</xpath></validate>
           <to uri="jms:fooOrBar"/>
        </when>
        ...
      

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            davsclaus Claus Ibsen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: