.end() in Apache Camel
end() is a grey area in, if there is one, Camel's best practice. I can't find any articles discuss on it. However, I still prefer stick with it rather than ignore it is because:
• The use of .end() is to indicate where a part, a block route code is ended. Like scope in other programming languages, in this case route scope, .end() is to let Camel know where the code ends and belongs to.
• .end() in Camel DSL is matching Camel Routes defined in XML. In XML, a opening tag MUST have a matched closing tag.
• Symmetry in Camel DSL syntax. Like bracket matching, the code looks better symmetrically with .end().
• Last and the most important, play safe. Camel has a few weird behaviours. Don't want to strange behaviours, caught fire at runtime in production just because .end() is ignored and left any chance for code vulnerability is being exploited.