camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ronny Aerts <>
Subject looking for a way to run javascript in camel and set message headers
Date Fri, 10 Jan 2014 19:05:19 GMT
Hello camel community,

I'm trying to figure it a way to run a real javascript procedures in camel as an alternative
to use java code out of a bean.

My company is using camel routes from a spring dsl xml file and we would like to minimize
our java coding effort. I know that javascript can be used in expressions, filters, ... but
I can't figure out to more with it like:
                               var content = request.getBody().toString().toUpperCase();
if (match("^UN[AB][+]{1}.*") != null) {
                request.headers.set("datatype", "edifact");
} else {
request.headers.set("datatype", "xml");

Please don't comment on the content of the javascript because this is just a very simple example.
Things that I surely want to do is setting message (and attachment) headers.

The fact that javascript can be loading from an external file (since camel 2.11) is already
of much help.

kind regards,
Ronny Aerts - Belgium

Intris nv
Wapenstilstandlaan 47
B-2600 Berchem
        Tel.  +32 3 326 50 75
Fax  +32 3 326 42 23<>

This is an e-mail from Intris. The information contained in this communication is intended
solely for use by the individual or entity to whom it is addressed.
Use of this communication by others is prohibited. If the e-mail message was sent to you by
mistake, please notify<>, destroy it without
reading, using, copying or disclosing its contents to any other person.
We accept no liability for damage related to data and/or documents which are communicated
by electronic mail.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message