Hans,

You'd expect a very limited amount of overhead in looking up the correct @Convertor in Camel, but that should take that long! Do you think you can provide us with a unit test or a test SA and attach that to a JIRA issue, so we can look into this?

Regards,

Gert

Hans Bogaards wrote:
Hi All,

I have run into a performance issue.

I have a file-poller that polls for text files (size approx. 350 kB). My
FileMarshaller reads the files and
makes them into a xml-string by prepending "<tag><![CDATA[" and appending
"]]></tag>".

Then the message content is set with 'message.setContent(new
StringSource(xml-string))'

The message then is routed using camel to an 'Expression' where it is read
as 'in.getBody(Document.class)'

The getBody can take up to 20 seconds on my machine.

When I rewrite it to 'in.getBody(String.class)' and then parse the message
myself using a 'DocumentBuilder':
           DocumentBuilderFactory dbFactory =
DocumentBuilderFactory.newInstance();
        dbFactory.setValidating(false);
        DocumentBuilder docBuilder = dbFactory.newDocumentBuilder();
        InputSource messageSource = new InputSource(new
StringReader(message));
        Document body = docBuilder.parse(messageSource);

it takes around only 500 ms!!

And when I rewrite the FileMarshaller to use a 'DocumentBuilder' to build
the message and set it as an DOMSource
the getBody return almost instantly.

Why does the in.getBody(Document.class) take so much more time than parsing
the message myself?


Reply via email to