Configuring the components - Cloud - 8.0

Logs and errors (Mediation)

Version
Cloud
8.0
Language
English
Product
Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
Module
Talend Studio
Content
Data Governance > Third-party systems > Logs and errors components (Mediation)
Data Quality and Preparation > Third-party systems > Logs and errors components (Mediation)
Design and Development > Third-party systems > Logs and errors components (Mediation)

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.