August 15, 2023

cIntercept – Docs for ESB 6.x

cIntercept

Intercepts each message sub-route and redirects it in another sub-route without
modifying the original one. When this detour is complete, message routing to the originally
intended target endpoints continues. This can be useful at testing time to simulate error
handling.

cIntercept Standard properties

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

The Standard
cIntercept component belongs to the Exception Handling family.

Usage

Usage rule

cIntercept is a start component of a sub-route.

Connections

Row / Route: Select the
Route link to intercept all the messages of all the
sub-routes listened to by the cIntercept.

 

Trigger / When: Select the
When link to filter the messages to intercept and
click the Component view.

In the Type list, select the type of language you will
use to declare your condition.

In the Condition field, type in the condition that will
be used to filter the messages.

All the messages that do not match this condition are dropped by default or can
be retrieved with the Otherwise link to a different
channel.

Limitation

To keep the original sub-routes untouched, cIntercept only be used in a separate sub-route
.

Scenario: Intercepting several routes and redirect them in a single new route

This scenario applies only to a Talend solution with ESB.

In this scenario, messages on two sub-routes are intercepted and routed along a new
sub-route, which is then terminated before the original sub-routes continue.

use_case_cintercept1.png

Dropping and linking the components

This scenario requires five cFile components, one
cIntercept component, one cProcessor component, and one cStop
component.

  1. From the Connectivity folder of the Palette, drop four cFile components onto the design workspace.
  2. Connect the two pairs of cFile components
    using Row > Route connections. Messages on these two sub-routes will be
    intercepted.
  3. From the Exception Handling folder, drop a cIntercept component onto the design
    workspace.
  4. From the Custom folder, drop a cProcessor component onto the design workspace.
  5. From the Connectivity folder, drop a fifth cFile component onto the design workspace.
  6. From the Miscellaneous folder, drop a
    cStop component onto the design
    workspace.
  7. Connect these four components one to the next using Row > Route connections.
    Along this sub-route, intercepted messages will be directed to a new
    endpoint before the entire Route is terminated.
  8. Label the components to better identify their roles in the Route.

Configuring the components and connections

In this scenario, the cIntercept component intercepts all
the messages on all the sub-routes as soon as the messages are sent and does not
have properties to set. The cStop component stops
the sub-route on which it is dropped before it completes and does not have
properties to set. Therefore, you only need to configure the messaging endpoints and
monitor components.

  1. Double-click the cFile component labeled
    Sender_1 to display its Basic settings view in the Component tab.

    use_case_cintercept2.png

  2. In the Path field, specify the file path
    to the first source your are going to send messages from, and leave the
    other parameters as they are.
  3. Double-click the cFile component labeled
    Receiver_1 to display its Basic settings view in the Component tab.

    use_case_cintercept3.png

  4. In the Path field, specify the file path
    to the first destination you are going to send messages to, and leave the
    other parameters as they are.
  5. In the same way, set the cFile components
    labeled Sender_2 and Receiver_2 across the second sub-route.
  6. Double-click the cProcessor component,
    which is labeled Monitor, to display its
    Basic settings view in the Component tab, and customize the code in the
    Code area to display the file names of
    the messages intercepted on the console:

  7. Double-click the cFile component labeled
    Receiver_3 to display its Basic settings view in the Component tab.

    use_case_cintercept7.png

  8. In the Path field, specify the file path
    to the destination for the intercepted messages, and leave the other
    parameters as they are.
  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 have a look at the generated code.

    use_case_cintercept8.png

    As shown in this piece of code, Interceptor intercepts
    all messages on route, the intercepted messages are directed
    .to the endpoint Receiver_3, and cStop_1
    terminates message routing before the messages are routed from
    the endpoint Sender_1
    .to the endpoint Receiver_1
    and from the endpoint Sender_2
    .to the endpoint Receiver_2.
  2. Click the Run view and click the
    Run button to launch the execution of
    your Route. You can also press F6 to
    execute it.

    RESULT: Files are sent from the endpoints, caught by the cIntercept component, monitored by the cProcessor component and sent to a new endpoint, and then
    the original sub-routes are terminated before they can continue.
    use_case_cintercept9.png


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