camel-dev mailing list archives

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

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);
            return;
        }

        ...
        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
in.

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:
http://www.nabble.com/from-http%3A--...-to-file%3A--...-td17739149s22882.html


Med venlig hilsen

Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk


Mime
View raw message