Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
xml
xml
	<camel:camelContext trace="true" xmlns="http://camel.apache.org/schema/osgi"> (1)

		<camel:route> 
			<camel:from uri="file://d:/temp/data/reportincident/?move=d:/temp/donebackup/${date:now:yyyyMMdd}/${file:name.noext}.bak" /> (2)
			<camel:setHeader headerName="origin"> (3)
				<camel:constant>file</camel:constant>
			</camel:setHeader>
			<camel:unmarshal ref="bindyDataformat" /> (4)
			<camel:to uri="queuingservice:queue:in" /> (5)
		</camel:route>
...

Remarks :
(1) - camel:camelContext tag is used to instantiate the camelcontext at the launch of the bundle. The trace parameter is defined as true so the tracing will be available on the console
(2) - The from uri="file" informs Camel that a file component must be started and it will listen for incoming files deposited in the directory d:/temp/data/reportincident. When the file is processed (end of the Camel route), then it is moved to the directory d:/temp/donebackup/ where the file is renamed (.bak extension is added). During the process of the file and till the route is not finished, the file will be locked
(3) - A header is added to the message with the property origin setted to file
(4) - To parse the content of the CSV file into a collection of incident objects, we use the action unmarshall where the reference provided corresponds to the bean BindyCsvDataFormat instantiated by Spring
(5) - The result of the parsing process is copied as a message in the queue:in

...