July 30, 2023

cWireTap – Docs for ESB ESB 7.x

cWireTap

Wiretaps messages to a user defined URI while they are sent to their original
endpoint. cWireTap 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.

For more information about how to use the languages to create an expression, see
the site http://camel.apache.org/languages.html.

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

Wiretapping a message in a Route

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

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

cWireTap_1.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.

    cWireTap_2.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.

    cWireTap_3.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.

    cWireTap_4.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.

    cWireTap_5.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.

    cWireTap_6.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.

    cWireTap_7.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.

    cWireTap_8.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