Triggers - 6.2

Talend MDM Platform Studio User Guide

EnrichVersion
6.2
EnrichProdName
Talend MDM Platform
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. You have the appropriate user authorization to create Triggers.

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.

When you select the workflowcontext service, for example, you can access a list of all deployed workflows directly from the Trigger editor and this simplifies the process of creating a Trigger.

In the Service Parameters area, you can specify the Workflow process version number and the user name and password for accessing the BPM server. The specified credentials here will override the default settings for the Bonita technical users in the file <$INSTALLDIR>\conf\mdm.conf where <$INSTALLDIR> specifies the path where the MDM server has been installed. For more information, see the Talend Installation Guide.

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 test, 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.

How to test Triggers in the Studio

Talend Studio allows you to test Triggers to see if one or more Triggers which match the test conditions defined by an event record will be executed as expected.

The event record which is used to test Triggers will be processed by the Event Manager. When the conditions defined in the event record correspond to the execution conditions of a Trigger, the Trigger will be executed.

For synchronous Triggers, the execution results will be returned directly. For asynchronous Triggers, you have to check the log of activity on MDM server to figure out the real status of the execution results.

Prerequisite(s): You have already connected to the MDM server. One or more Triggers to be tested have already been deployed to the MDM server.

For further information about Triggers, see Triggers.

To test Triggers in the Studio, do the following:

  1. In the MDM Repository tree view, expand the Event Management and Trigger nodes and then select Test from the contextual menu.

  2. A dialog box opens asking you to select the appropriate server on which the MDM server is installed.

    Once you have made your choice, click OK to close the dialog box.

  3. The [Select Record] dialog box opens. The selected server is shown in the Server list.

    Select UpdateReport from the Container list.

    The UpdateReport document contains all the event records generated whenever a data record is created, updated or deleted. Each time the Event Manager receives a document, it tries to evaluate the conditions of each Trigger against this document.

    You need to choose one event record to test Triggers.

  4. Click the icon next to the Entity list to display a list of records.

  5. If required, define conditions in the Record Search area to filter the records to be displayed. For example, you can select a specific time in the From and To fields respectively to display only the records generated during that period of time.

  6. Click the desired record to display its content in the Record Content area.

    If needed, you can create a new record to be used for testing Triggers. For more information, see How to create a new record for testing Triggers.

  7. Click Test. A prompt message pops up, showing that one or more Triggers which match the conditions of the selected event record are executed successfully.

  8. To verify the execution results of those Triggers, consult the mdm.log file in one of the following ways:

    • In the Server Explorer panel, right-click the connection to the server where MDM server is installed, and then click View Server Log. A Console opens displaying the most recent contents of the mdm.log file.

    • You can also view the contents of the mdm.log file in a browser. For further information about viewing the log of activity on MDM sever, see Viewing the log of activity on the MDM server.

    • If you have direct access to the MDM server, you can also consult the file directly in the <$INSTALLDIR>/log directory.

How to create a new record for testing Triggers

Talend Studio allows you to create a new record to be used for testing Triggers if you cannot find the desired record in the listed records. For more information about testing Triggers in the Studio, see How to test Triggers in the Studio.

To create a new record for testing Triggers, do the following:

  1. In the [Select Record] dialog box, right-click in the area where the records are listed and click New Record.

  2. A dialog box opens providing an XML editor and viewer.

    Enter a record that defines the conditions to be used to test Triggers. You can also have a tree view of the record by clicking the Tree tab.

    In this example, one piece of UpdateReport document is prepared. Note that the Update Reports are stored in Talend MDM as an XML document like any other master data but with a pre-defined, static data model.

  3. Select the appropriate data model from the Data Model list. In this example, select UpdateReport.

  4. If the newly created record is not an UpdateReport document, select the Fire a change event (update report) and triggers check box so that the new record will be written into the UpdateReport and the eligible Triggers will be executed directly.

    After selecting the Fire a change event (update report) and triggers check box, if required, select the Enable verification by before processes check box to enable the verification of the new record by the Before Saving processes. For more information about Process types, see Process types.

    In this example, leave the Fire a change event (update report) and triggers check box cleared.

  5. Click Save to save your changes.

How to export Triggers

From Talend Studio you can export one or multiple Triggers in order to exchange them between two different MDM Servers or Repositories.

The steps to export one or multiple Triggers are similar to those for any other data object in the MDM Repository tree view. For detailed information on how to export data containers, see How to export data models.

How to import Triggers

From Talend Studio, you can import Triggers into the current MDM Repository that have been created in other MDM Repositories.

The steps to import one or multiple Triggers are similar to those for any other data object in the MDM Repository tree view. For detailed information on how to import data containers, see How to import data models.

How to edit a Trigger

You can open a Trigger you have already created to check its settings and/or edit the defined parameters.

Prerequisite(s): You have already connected to the MDM server in Talend Studio. At least one Trigger exists.

To edit a Trigger:

  1. In the MDM Repository tree view, expand the Trigger node.

  2. Right-click the Trigger you want to edit and select Edit from the contextual menu.

    An editor opens on the selected Trigger in the workspace.

  3. Modify the Trigger parameters as needed and then click the save icon on the toolbar or press Ctrl + S on your keyboard to save your changes.

The selected Trigger is modified accordingly.

Note

If you try to update a Trigger that has been modified by somebody else after you have retrieved it from the database, a warning message displays to warn you that saving your modifications will overwrite the other user's changes.

How to copy/paste a Trigger

To avoid creating one or multiple Triggers from scratch, you can copy an existing one in the MDM Repository tree view and modify its parameters to have a new Trigger.

Prerequisite(s): You have already connected to the MDM server in Talend Studio. At least one Trigger exists.

To copy/paste a Trigger, do the following:

  1. In the MDM Repository tree view, expand the Event Management node and then the Trigger node.

  2. Right-click the Trigger you want to copy and select Copy from the contextual menu.

  3. Right-click the Trigger node and select Paste from the contextual menu.

    A dialog box displays prompting you to enter a name for the new Trigger.

  4. Enter a name for the new Trigger and click OK to validate the changes and close the dialog box.

    The new Trigger is listed under the Trigger node in the MDM Repository tree view.

How to duplicate a Trigger

To avoid creating one or multiple Triggers from scratch, you can duplicate an existing one in the MDM Repository tree view and modify its parameters to have a new Trigger.

Prerequisite(s): You have already connected to the MDM server in Talend Studio. At least one Trigger exists.

To duplicate a Trigger, do the following:

  1. In the MDM Repository tree view, expand the Trigger node.

  2. Right-click the Trigger you want to duplicate and select Duplicate from the contextual menu.

    A dialog box displays prompting you to enter a name for the new Trigger.