LibraryToggle FramesPrintFeedback

The loop pattern enables you to process a message multiple times. It is used mainly for testing.

[Important]Default mode

Notice by default the loop uses the same exchange throughout the looping. So the result from the previous iteration is used for the next (eg Pipes And Filters). From Camel 2.8 onwards you can enable copy mode instead. See the options table for more details.

On each loop iteration, two exchange properties are set, which can optionally be read by any processors included in the loop.

Property Description
CamelIterationCount Fuse Mediation Router 1.x: Total number of iterations to be run
CamelIterationIndex Fuse Mediation Router 1.x: Index of the current iteration (0 based)
CamelLoopSize Fuse Mediation Router 2.0: Total number of loops
CamelLoopIndex Fuse Mediation Router 2.0: Index of the current iteration (0 based)

The loop DSL command supports the following options:

Name Default Value Description
copy false Camel 2.8: Whether or not copy mode is used. If false then the same Exchange is being used throughout the looping. So the result from the previous iteration will be visible for the next iteration. Instead you can enable copy mode, and then each iteration is restarting with a fresh copy of the input Exchange.
Comments powered by Disqus
loading table of contents...