Skip to main content Skip to complementary content

Configuring the components

Procedure

  1. Double-click the cFile component, which is labeled File_source, to display its Basic settings view in the Component tab.
  2. In the Path field, browse to or enter the input file path, and leave the other parameters as they are.
    In this scenario, there are four text files in the specified directory: a.txt, b.txt, c.txt and d.txt, the contents of which are This is a!, This is b!, This is c!, and This is d! respectively.
  3. Double-click the cAggregate component, which is labeled Aggregator, to display its Basic settings view in the Component tab.
  4. In the Language field, select Constant or Simple as the expression language.
    In the Expression field, enter the expression "getBody(String.class)" to retrieve the body of the message.
    In the Strategy field, enter the name of the Java bean AggregateBody you just created.
    Select the Number of messages check box and type in 2 in the field.
  5. Double-click the cProcessor component labeled Monitor_before to display its Basic settings view in the Component tab.
  6. In the Code box, customize the code as follows so that the Run console displays the message contents before an aggregation takes place:
    System.out.println("Before aggregation: "+
    exchange.getIn().getBody(String.class));
  7. In the same way, configure the cProcessor component labeled Monitor_after so that the Run console displays the message contents after an aggregation takes place:
    System.out.println("After aggregation: "+
    exchange.getIn().getBody(String.class));
  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!