The below rule should work, it does the same thing as your second rule does.
from("file:///file.txt").splitter(expression).convertBodyTo(String.class).to("file://result.txt")
I just dug the code of ConvertBodyType, found there is an issue of this
type's toString method, it will not reflect your setting of TypeClass.I created a JIRA[1] ticked for it. BTW, I will add a convertBodyTo(String) mehtod as you suggested. [1]https://issues.apache.org/activemq/browse/CAMEL-1027 Willem LavanyaKC wrote: > I am having a problem using the below code: > > from("file:///file.txt").splitter(expression).convertBodyTo(String.class).to("file://result.txt") > > This does not work, the reason being the convertBodyTo method of > ProcessorType class returns convertBodyTo[null] though I have set the value > to String.class. However the following works: > > SplitterType splitter = from("file:///file.txt").splitter(expression); > splitter.addOutput(new ConvertBodyType("java.lang.String")); > splitter.to("file://result.txt"); > > Did anyone come across such problem? It would be nice if a > convertBodyTo(String) method is exposed in ProcessorType. > > Thanks, > Lavanya.
