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

How to use an object that is inside the object sent on body to do splitting

$
0
0
Dear Camel Experts,

First of all thanks a lot, this framework is great.
Maybe this is a very dumb question but It will help to clarify my
understanding of camel.
I have a seda queue where I insert objects of type FromData.
FromData has a method

public GenericFile<File> getFirstFile () {
return files.values().iterator().next();

Now in my route I want to split the contents of the file and I came up with
this solution. Is there a better way to refer to body.firstFile in a better
way or inside the second split otherwise of doing
.split(simple("${body.firstFile}"))

public void configure() {
from("seda:processReceiver")
.split(simple("${body.firstFile}"))
.split(body().tokenize(",")).streaming()
.process(new Processor() {
public void process(Exchange msg) {
System.out.println(msg.getIn().getBody());

});

Viewing all articles
Browse latest Browse all 5648

Trending Articles