> I have the same problem, I want to split the content of a text file to
> others messages and send then to a queue. What is the type tu return with
> evaluate() method.
Basically what you should return from this evaluate method in case of
splitter should be an array or collection. Otherwise your message will
be splitted into.. one part ;)
> from("file:insert_request.sql").splitter(new Expression<Exchange>()
> {
> public Object evaluate(Exchange exchange)
> {
> return exchange.getIn().getBody(String.class).split("\n");
> }
> }).to("jdbc:dataSource");
But instead of writing it the way you do, you can write something like
from("file:insert_request.sql").splitter(body(String.class).tokenize("\n")).to("jdbc:dataSource");
Should do the same thing, but definitely looks simpler ;)
Roman