Triggers - 6.5

Talend Open Studio for MDM User Guide

EnrichVersion
6.5
EnrichProdName
Talend Open Studio for MDM
task
Data Governance
Data Quality and Preparation
Design and Development
EnrichPlatform
Talend Studio

Triggers are used to link the MDM Hub and the Data Models you define in the Studio. You can use Triggers to call specific Processes under certain conditions.

The Triggers you define in Talend Studio enable different services to be undertaken on specific data records.

Then, whenever a business user creates or modifies a data record from Talend MDM Web User Interface, for example, a Trigger kicks in and the relevant event-based Process is undertaken by the Studio.

Creating a Trigger

Note

The section below explains how to create a Trigger from scratch, however, Talend Studio enables you as well to automatically generate Triggers based on the Jobs listed under the Job Designs node in the MDM Repository tree view. You can then do any modifications in the generated Trigger, if required. For further information, see Generating a job-based Trigger.

Triggers are rules for transforming data. You can easily define Triggers on specific business entities/elements from Talend Studio.

Parameters to set when defining Triggers include:

  • selecting the business entity you want to Trigger the Process on,

  • setting conditions on its content,

  • deciding the execution mode,

  • selecting the service to Trigger,

  • setting the service parameters.

Prerequisite(s): You have already connected to the MDM server from Talend Studio.

For this example, a data model called Product has been created in Talend Studio. This data model has two business entities: Product and ProductFamily. Several attributes have been created in the Product entity including Price and Family. For further information about how to create a data model, see Setting up a data model.

A Process has been created and named Call_Job. One service has been defined in this Process to launch a validation Job whenever a price of an item that belongs to a specific family has been changed through Talend MDM Web User Interface. For further information about how to create such a Process, see How to create a Process from scratch.

What is left to be done now is to create a Trigger and configure it to launch the Call a Job from MDM Process that will by turn launch the Talend price validation Job.

The sub-sections below explain in detail the procedures necessary to complete the creation of such a Trigger.

How to define the business entities on which to trigger a specific Process

To create a Trigger, you must first define the business entities in a selected data model on which you want to trigger a specific Process. You also need to define the execution mode. To do this:

  1. In the MDM Repository tree view, expand Event Management and then right-click Triggers and select New from the contextual menu.

    The [New Trigger] dialog box displays.

  2. Enter a name for the new Trigger and then click OK to close the dialog box.

    An editor for the newly created Trigger opens in the workspace.

    Warning

    No spaces are allowed in the Trigger name. The OK button in the dialog box will be unavailable as long as there is a space in the instance name.

  3. In the Description field, enter a description to identify the Trigger being created.

    In this example, the Trigger will launch a Process that will by turn launch the Job ValidatePriceChange_0.1.

  4. Click the three-dot button next to the Entity field to open a dialog box where you can select the business entity you want to trigger the Process on, Product in this example.

  5. In the open dialog box, click the Data Models arrow and select the data model that holds the business entity you want to run the Trigger on.

  6. Select the business entity in the list and click Add to close the dialog box.

    The selected business entity name displays in the Entity field.

  7. Select the check box next to the execution mode you want to use:

Select

to...

Execute Synchronously

immediately executes the triggered Process. In most cases, this implies that an open connection from a source system will not be released until the data record has been pushed to the destination system and the connection is released by the destination system.

Execution Order: enter an integer value (equal to or greater than zero) in this field to specify the order in which this Trigger will be executed if it is among multiple Triggers which are eligible for a given event. The lower the value, the earlier the Trigger will be executed.

Bear in mind the following:

  • If no value is specified for one trigger, its execution order will be defaulted to zero.

  • If the same value is specified for two or more triggers eligible for a given event, the execution order of those triggers will be random.

Deactivate

To put the defined Trigger on hold.

How to select the service to Trigger and set the service parameters

After defining the business entity on which you want to trigger a specific Process, you need to select a service to run on the defined business entity and set the service parameters.

To select a service to trigger and set the parameters, do the following:

  1. In the Service area, click the Service JNDI Name arrow and select from the list the service you want to kick off by the Trigger, callprocess in this example.

    Note

    The services you can find in the list are pre configured MDM services. Click the button to open a dialog box that gives information about what the service does and its parameters.

  2. In the Service Parameters area, define the parameters of the service you select in the list.

    When you select the callprocess service, you just need to click the name of the Process you want to trigger, Call_Job in this example. For more information about how to create a Process from scratch, see How to create a Process from scratch.

The callprocess service is one of the most important available services on the list. When you select this service, all Processes you already created in Talend Studio are listed in the Service Parameters area and you can call any of them to transform and cross-reference master data. For more information on Processes, see Processes.

The parameters you need to define in the Service Parameters area differ according to the selected service in the service list. Talend Studio simplifies this task for you by creating the underlying XML code for the proper execution of the trigger.

When you select the callJob service, for example, you can access a list of all deployed Jobs directly from the Trigger editor.

Note

For certain services, you can switch between a graphical editor and a text editor upon clicking the Sheet and Source tabs respectively. You can define the service parameters in either editors and any modifications you do in one of the two editors will be reflected in the other.

How to set conditions for the Trigger

After selecting a pre-configured service to run on the selected business entity and defining the service parameters, you must set conditions on the content of the selected business entity.

To configure the conditions for this Trigger, do the following:

  1. In the Trigger xPath Expressions area, click the button to add a new XPath line to the table where you can set the first condition.

  2. Click in the new line, and then click the three-dot button to open a dialog box where you can select the entity and/or element on which you want to define conditions, Update/OperationType in this example.

  3. Click in the Operator column and select an operator from the list.

  4. In the Value column, enter a value for each of the selected business entities/elements, the value is usually the name of the entity or element. Enter the UPDATE value in this example (case sensitive).

  5. In the Condition Id column, enter a unique identifier for the condition you want to set on the selected business entity/element, C1 in this example.

    This first condition means that the Trigger will be executed only on the records in the Update entity when there is an update operation. You may want to activate this Trigger only if the update operation is done on the Price attribute. So, follow the same steps to define this second condition on the Item/path attribute using the Price value and C2 condition.

  6. In the Conditions area, enter the query you want to undertake on the data record using the condition IDs you set earlier, C1 And C2 in this example.

    The Trigger created in the above procedure means that you want the Trigger to be executed on a record in the Update entity only when the Price attribute has been changed.

    Note

    When the conditions match the content of the data record, the selected service is triggered on the content of the data records that match the set conditions.

  7. Click the save icon on the toolbar or press Ctrl + S on your keyboard to save your changes.

This newly created trigger is listed under the Trigger node in the MDM Repository tree view.

Managing Triggers

An authorized user can also import/export, copy/paste and delete created Triggers from Talend Studio.

Note

It is also possible to import and share MDM complete projects or only a data model or part of the data model from the community web page, Talend Exchange. For further information, see Projects/objects on Talend Exchange.