Raju Guduri
Raju Guduri

Reputation: 1307

How Camel split/iterate over the list and send to queue individually?

I am new to camel, unable to figure out sending individual entity out of list to queue.

private void addIncomingFixMessageRoute() {     
    from(Endpoints.FIX_MESSAGE_IN_ROUTE)
    .routeId("IncomingFixMessageRoute")
    .bean(fixMessageTransformer, "transform")
    .marshal().json()
    .to("activemq:queue:feed");
}

Here the transform method of the bean fixMessageTransformer returns List<String>, now I want to apply splitter which iterates and send each element to queue individually. Unable to figure out how I would achieve it.

Tried by applying .split().tokenize(), but no luck.

Upvotes: 0

Views: 1240

Answers (1)

Claus Ibsen
Claus Ibsen

Reputation: 55540

Just add the splitter on the body, and it will split it.

 .split(body())
   ...

Upvotes: 3

Related Questions