Procedure
-
Double-click the first cFile
component, which is labeled Read, to open its Basic settings view in the Component tab.
- In the Path field, enter or browse to the path to the source files, and leave the other parameters as they are.
- Repeat these steps to define the target folder in property settings of the second cFile component, which is labeled Write.
-
Double-click the first cProcessor component, which is labeled
Read_monitor, to open its Basics
settings view in the Component
tab.
-
In the Code area, customize the code to display the time
each message is read from the source:
Date date=new Date(); SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss"); String s = formatter.format(date); System.out.println("\nMessage "+ exchange.getIn().getHeader("CamelFileName")+ " read at "+(s));
-
Repeat these steps to configure the second cProcessor component, which is labeled
Write_monitor, to display the time each message is written
to the target:
Date date=new Date(); SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss"); String s = formatter.format(date); System.out.println("Message "+ exchange.getIn().getHeader("CamelFileName")+ " written at "+(s));
-
Double-click the cDelayer
component, which is labeled Delay_timer, to open its
Basic settings view in the Component tab.
-
In the Time to wait (in ms) field, enter
the number of milliseconds by which you want to delay message delivery. Note
that the value must be a positive integer.
In this use case, each message needs to be delivered after a 20-second delay.
- Press Ctrl+S to save your Route.