camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen">
Subject FileProducer - Some strange code
Date Mon, 23 Jun 2008 08:33:25 GMT

In the file component (FileProducer)

FileProducer (for writing files) has some strange code:

  public void process(FileExchange exchange) throws Exception {
        if (ExchangeHelper.isOutCapable(exchange)) {
            // lets poll the file
            Message out = exchange.getOut(true);
            endpoint.configureMessage(endpoint.getFile(), out);

        Normal code to do the writing of the in body

The code above will for all Out capable exchanges (eg InOut) poll a file instead.

I haven't digged deeper yet, but I wanted to hear if anyone knows the reason for this code.

See the unit test in camel-jetty component HttpToFileTest that demonstrates a user request
on the forum how to save http requests to files.
I needed to change the exchange pattern to in only to avoid the strange code above to kick

As I haven't had my 3rd cup of morning coffee yet I am in a state where I can't read the code
to well to understand the holy reason for it ;)

See also user forum for the user request:

Med venlig hilsen

Claus Ibsen
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576

View raw message