August 15, 2023

cWireTap – Docs for ESB 6.x

cWireTap

Routes messages to a separate endpoint while forwarded to the ultimate
destination.

cWireTap wiretaps messages to a
user defined URI while they are sent to their original endpoint. It
also allows you to populate a new message to this wiretap URI
concurrently.

cWireTap Standard properties

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

The Standard
cWireTap component belongs to the Routing family.

Basic settings

URI

The endpoint URI to send the wire tapped message.

Populate new exchange

Select this check box to populate a new message to the wiretap URI.

Populate Type

This option appears when the Populate new
exchange
check box is selected. The Populate Type is either Expression or Processor.

Expression: Using expression
allows you to set the message body of the new exchange.

Language: Select the language of the expression you
want to use to set the message body from None, Bean,
Constant, CorrelationID, EL,
Groovy, Header, JavaScript,
JoSQL, JSonPath, JXPath,
MVEL, OGNL, PHP,
Property, Python, Ruby,
Simple, SpEL, SQL,
XPath, and XQuery.

Expression TXT: Enter the expression to set the
message body.

  Processor: Using
processor gives you full power to specify how the exchange is populated
as you can set properties, headers and so on to the message with a piece
of Java code in the Code field.
Copy the original message

Select this check box to create a copy of the original exchange, which
will be the totally the same as the original one. If this check box is
not selected, only a new exchange with the same endpoint name will be
created. The message body and headers are null.

The exchange
pattern is InOnly for both
conditions.

Usage

Usage rule

cWireTap can be a middle
component in a Route.

Limitation

 n/a

Scenario: Wiretapping a message in a Route

This scenario applies only to a Talend solution with ESB.

In this scenario, a cWireTap component is used to route a
message to a separate endpoint while it is routed to the ultimate destination.

use_case-cwiretap1.png

Dropping and linking the components

  1. From the Palette, expand the Connectivity folder, and drop a cFile and two cMessagingEndpoint components onto the design
    workspace.
  2. Expand the Routing folder, and drop a
    cWireTap component onto the design
    workspace.
  3. Expand the Core folder, and drop a
    cJavaDSLProcessor components onto the
    design workspace.
  4. Expand the Custom folder, and drop and
    two cProcessor components onto the design
    workspace.
  5. Right-click the cFile component, select
    Row > Route from the contextual menu and click the cWireTap component.
  6. Repeat this operation to connect the components as shown above.
  7. Label the components to better identify their functionality.

Configuring the components

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

    use_case-cwiretap2.png

  2. In the Path field, browse to or enter the
    input file path. In this use case, there is a Hello.txt
    file in the specified file path, which contains the content Hello
    World!
    . Leave the other parameters as they are.
  3. Double-click the cWireTap
    component to display its Basic settings
    view in the Component tab.

    use_case-cwiretap3.png

  4. Enter "direct:a" in the URI field to route the wiretapped message to this endpoint.

    Select the Populate new exchange check box, select Processor as the populate type, and then enter the following code in the Code box to display the file name of the wiretapped message and its content on the console:
  5. Double-click the cJavaDSLProcessor component to display its Basic settings view in the Component tab.

    use_case-cwiretap4.png

  6. In the Code field, enter the Java code
    .to("direct:b") to define the URI of the endpoint to route
    the original message to.
  7. Double-click the cMessagingEndpoint component labeled Endpoint_a to display its Basic
    settings
    view in the Component
    tab. Enter "direct:a" in the URI field to retrieve the message routed to this
    endpoint.

    use_case-cwiretap5.png

    Repeat this operation to set the endpoint URI for Endpoint_b.
  8. Double-click the cProcessor component labeled Monitor_a to display its Basic settings view in the Component tab. Enter the following code in the Code box to display the file name of the message routed to Endpoint_a.

    use_case-cwiretap6.png

    Then, configure the other cProcessor component in the same way to display the file name of the message routed to Endpoint_b.

  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-cwiretap8.png

    In this partially shown code, any message from the endpoint Source
    will be wiretapped by .wireTap and routed to
    "direct:a". The fine name and content of each
    wiretapped message will be displayed on the console. The original message will
    be routed .to an endpoint identified by the URI
    "direct:b", which is defined in cJavaDSLProcessor_1.
  2. Click the Run view to display it and click the Run button to launch the execution of your Route.
    You can also press F6 to execute it.

    RESULT: The source message is wiretapped and routed to endpoint a as well as being routed to endpoint b.

    use_case-cwiretap9.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