Skip to main content Skip to complementary content

Configuring the components and connections

Procedure

  1. Double-click the cFile component labeled Sender to display its Basic settings view in the Component tab.
  2. In the Path field, fill in or browse to the path to the folder that holds the source files.
    From the Encoding list, select the encoding type of your source files.
    In the FileName field, type in the file name of the source message. You can skip this step if the source folder contains only one file.
  3. Repeat steps 1 and 2 above to define the output file path and encoding type in the Basic settings view of the other cFile component, which is labeled Receiver. Leave the FileName field blank.
  4. Double-click the cSplitter component to display its Basic settings view in the Component tab.
    In this use case, to split the message into sub-messages at each person node of the XML file, select XPath in the Language list and type in "/people/person" in the Expression field.
  5. Double-click the cSetHeader component, which is labeled Set_file_name to display its Basic settings view in the Component tab.
  6. Click [+] to add a row to the Headers table.
    In the Name field, type in the name of the header you want to give to the messages.
    Here, to define the file name for each incoming message, fill in "CamelFileName" as the header name.
    Select Bean in the Language field and type in the name of the predefined Java Bean in the Value field, beans.setFileNames.class in this use case.
  7. Double-click the cProcessor component to display its Basic settings view in the Component tab, and customize the code so that the console will display information the way you want.
    In this use case, to display the file name each message routed to the receiving endpoint, customize the code as follows:
    System.out.println("File received: "+ 
    exchange.getIn().getHeader("CamelFileName"));
  8. Press Ctrl+S to save your Route.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!