Question

My scenario is to read a file from a file endpoint which contains only key value paris like a property file and take a few data from it based on the key .

Any idea how to do them other that using a custom bean or java component.

I would like to know if this is possible any way in Mule or Camel.

Thanks in advance.

Was it helpful?

Solution

If you want to use a Camel route, to pickup files, then something like this

from("file:inbox")
   .convertBodyTo(Properties.class)
   .log("The foo value is {${body[foo]}")
   .log("The bar value is {${body[bar]}")

What we then need is a type converter from java.io.File -> java.util.Properties. Which we could add to camel-core out of the box.

I logged a ticket to add that type converter out of the box in Camel: https://issues.apache.org/jira/browse/CAMEL-7312

OTHER TIPS

I think to this problem explained, the very easy solution is to use java.util.Properties class. Load the file using Properties class which maintains key value pair only.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top