Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Using Camel File component to Poll a directory (but not read the files)

$
0
0
Hi,
I'm not sure if this is the correct place to post
this, but I stumbled on it looking for an answer to my problem...
I have a wierd situation with a Camel route file
component where the content was being read and now does not appear to be
so.
I've observed the situation from the following code
snippet

   @Override
   public void process(Exchange exchange)

         final String fileName =
exchange.getIn().getHeader("CamelFileNameOnly", String.class);
         if (fileName != null)

             MDC.put("id",
fileName);
         }
         LOGGER.debug(">> {}",
getClass().getSimpleName());
         Map<String, Object> hdrMap =
exchange.getIn().getHeaders();
         Map<String, DataHandler>
atchMap = exchange.getIn().getAttachments();
         try {
             Object manBody =
exchange.getIn().getMandatoryBody();
             Object manBodyAsStr =
exchange.getIn().getMandatoryBody(String.class);
         } catch
(InvalidPayloadException e1) {
             // TODO Auto-generated
catch block
             e1.printStackTrace();
    }

    final String fileContent =
exchange.getIn().getBody(String.class);

Note that there are some extra lines of code I've
thrown in for troubleshooting. Also, fileName is filled and fileContent is
null. :S The file is a text file, so I don't get what's going
astray.
I've even tried:
final String fileContent =
exchange.getIn().getBody(byte[].class);

just to test if Camel might be picking up the file
as binary, but fileContent is still null.
I've been testing this on a Win7 machine &
haven't had the opportunity to try on a non-MS machine yet.
Hopefully, it is something simple (& expected)
that if you are using a Windows puke machine, just use the pepto api
:)
Thanks a bunch,
- Doug

Viewing all articles
Browse latest Browse all 5648

Latest Images

Trending Articles



Latest Images