July 30, 2023

cErrorHandler – Docs for ESB ESB 7.x

cErrorHandler

Processes errors in the message routing.

cErrorHandler Standard properties

These properties are used to configure cErrorHandler running in the Standard Job framework.

The Standard
cErrorHandler component belongs to the Exception Handling family.

Basic settings

Default Handler

This error handler does not support a dead letter queue and will
return exceptions back to the caller.

 

Set Maximum Redeliveries: select
this check box to set the number of redeliveries in the Maximum Redeliveries (int) field.

 

Set Redelivery Delay: select this
check box to set the initial redelivery delay (in milliseconds) in
the Redelivery Delay (long)
field.

 

Set Retry Attempted Log Level:
select this check box to select the log level in the Level list for log messages when retries
are attempted.

 

Asynchronized Delayed Redelivery:
select this check box to allow asynchronous delayed
redelivery.

 

More Configurations by Code:
select this check box to enter codes in the Code box for further configuration.

Dead Letter

This handler supports attempting to redeliver the message exchange
a number of times before sending it to a dead letter
endpoint.

 

Dead Letter Uri: select this
check box to define the endpoint of the dead letter queue.

Other parameters share the same meaning as those of the default
handler.

Logging Handler

This handler logs the exceptions.

 

Set Logger Name: select this
check box to give a name to the logger in the Name field.

 

Set Log Level: select this check
box to decide the log level from the Level list.

Usage

Usage rule

cErrorHandler is used separately
or as a middle or end component in a Route. If this component is
used separately, it will handle errors in all sub-routes. If this
component is used in the middle or end of a sub-route, it will only
handle exceptions that happen in the components of this sub-route,
either before or after the cErrorHandler.

Limitation

 n/a

Logging the exception thrown during a client/server talk

This scenario applies only to Talend Open Studio for ESB, Talend Data Services Platform and Talend Data Fabric.

In this scenario, a Jetty server is started before a client browser requests access to it.
Then an exception is thrown at the server side and logged by cErrorHandler.

Dropping and linking the components

  1. Drop the following components from the Palette onto the
    workspace: cMessagingEndpoint, cErrorHandler and cProcessor, labelled as Jetty_Server, Error_Handler
    and Throw_Exception respectively.
  2. Link cMessagingEndpoint and cProcessor using a Row >
    Route connection.

    cErrorHandler_1.png

Configuring the components

  1. Double-click cErrorHandler to open its Basic settings view in the Component tab.

    cErrorHandler_2.png

  2. Select Logging Handler to log the exceptions that are
    thrown.
  3. Double-click cMessagingEndpoint to open its Basic settings view in the Component tab.

    cErrorHandler_3.png

  4. In the Uri field, enter
    jetty:http://localhost:8889/service to specify the Jetty
    server.
  5. Click Advanced settings for
    further setup.

    cErrorHandler_4.png

  6. In the Dependencies table, click the [+] button to add a line and select
    jetty from the Camel
    component
    list.
  7. Double-click cProcessor to
    open its Basic settings view in the
    Component tab.

    cErrorHandler_5.png

  8. In the Code box, enter throw new Exception("server
    side error")
    to throw an exception.
  9. Press Ctrl+S to save your Route.

Viewing code and executing the Route

  1. Click the Code tab at the bottom of the design workspace
    to check the generated code.

    cErrorHandler_6.png

    As shown above, the route starts from the endpoint Jetty_Server
    and throws the exception of server side error via
    cProcessor_1.
  2. Press F6 to execute the Route.

    cErrorHandler_7.png

    The Jetty server has started.
  3. Launch an Internet browser and enter
    http://localhost:8889/service (the Jetty server URI
    configured above) in the address bar to access the server.

    cErrorHandler_8.png

    As shown above, the request failed due to the server error.
  4. Go to the Studio and check the results in the Run
    tab.

    cErrorHandler_9.png

    As shown above, cErrorHandler has logged the exception
    at the level of ERROR.

Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x