Camel supports JavaScript/ECMAScript among other Scripting Languages to allow an Expression or Predicate to be used in the DSL or Xml Configuration.

To use a JavaScript expression use the following Java code

... javaScript("someJavaScriptExpression") ... 

For example you could use the javaScript function to create an Predicate in a Message Filter or as an Expression for a Recipient List


In the sample below we use JavaScript to create a Predicate use in the route path, to route exchanges from admin users to a special queue.

            .when().javaScript("request.headers.get('user') == 'admin'").to("seda:adminQueue")

And a Spring DSL sample as well:

        <from uri="direct:start"/>
                <javaScript>request.headers.get('user') == 'admin'</javaScript>
                <to uri="seda:adminQueue"/>
                <to uri="seda:regularQueue"/>

Error rendering macro 'include'

org.owasp.validator.html.ScanException: java.util.EmptyStackException

  • No labels