Skip to main content Skip to complementary content
Close announcements banner

Configuring the components

Procedure

  1. Double-click the cOnException component, which is labelled Ignore_exception, to open its Basic settings view in the Component tab.
  2. Click the plus button to add a line in the Exceptions table, and define the exception to catch. In this example, enter java.io.IOException to handle IO exceptions.
    In the Exception behavior area, select the Ignore the exceptions option to ignore exceptions and let message routing continue. Leave the other parameters as they are.
  3. Double-click the cFile component, which is labelled Source, to open its Basic settings view in the Component tab.
  4. In the Path field, enter the path of the message source, and leave the other parameters as they are.
  5. Double-click the cBean component, which is labelled Throw_exception, to open its Basic settings view in the Component tab.
  6. Select New Instance and in the Bean class field, enter the name of the bean to throw an IO exception, beans.throwIOException.class in this scenario.
    Note that this bean has already been defined in the Code node of the Repository and it looks like this:
    package beans;
    
    import java.io.IOException;
    
    import org.apache.camel.Exchange;
    
    
    public class throwIOException {
    
        /**
    
         * @throws IOException 
         */
        public static void helloExample(String message, Exchange exchange) throws IOException {
            throw new IOException("An IOException has been caught");
        }
    }
    For more information about creating and using JavaBeans, see Talend Studio User Guide.
  7. Double-click the cProcessor component, which is labelled Monitor, to open its Basic settings view in the Component tab.
  8. In the Code area, customize the code to display the file name of the consumed message on the Run console:
    System.out.println("Message consumed: "+ 
    exchange.getIn().getHeader("CamelFileName")); 
  9. 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 – let us know how we can improve!