Hello horyna,

horyna wrote
> But how to get the parameters into the route? I dont want to store
> everything into header, body ...this will grow up the code again

as far as I understood your requirement it boils down to the fact that you
have a couple of routes that share parts of their route definitions. Let's
assume you had some from() endpoints with different values to be set for the
header "h".

from("file:///.../a")
.setHeader("h", constant("a"));

Extract the commons parts to a parameterized method: 
private RouteDefinition callCommonPart(RouteDefinition from, String value) {
        return from.setHeader("h", constant(value));
}

And you can apply this in your route building like this:
RouteDefinition from = from("file:///.../a");
callCommonPart(from, "a");

When doing this you can specify the parameters at time of the route
definition, you don't have to loop values through header fields.

Doesn't this suffice your requirements?

Regards, mdo.





--
View this message in context: 
http://camel.465427.n5.nabble.com/Is-possible-to-wrap-a-part-of-route-tp5731917p5731964.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to