Building Jobs
Depending on your requirements, Talend Jobs can be constructed to run as one-off tasks, repeating events (eg. continuous polling), or as listeners acting on external input (eg. webservice endpoint). The type of Job needed determines how you construct the Job and which Talend Component(s) you add to it to facilitate the required outcome. It is common to split a Job into multiple parts, having a main Job which handles the event mechanism (ie. polling, listener), and sub Jobs that perform the primary integration task.
Types of Jobs
One-off tasks
These Jobs are straight forward and require no wrapping. They can be run manually from the Talend Studio, or deployed to the Runtime environment and triggered to run from the Talend CLI when necessary. The most simplest of Jobs can be built with just a single tJava
component that performs the required task - refer to Creating your first Job
for an example.
Repeating events
Components such as tInifiniteLoop
can be used to trigger a Job repeatedly. Useful when you wish to setup a poller to routinely query for items to process, or perform routine tasks. It is recommended to setup the repeater (eg. tInifiniteLoop) in a Main job, which calls a Sub Job via a tRunJob
component. This approach decouples the trigger from the primary task, and simplifies error handling steps.
For example, if you need to build a Job that continuously polls an external database for changes and applies them to Formbird, then you can setup a Main Job that contains the repeater (eg. tInfiniteLoop), which calls a Sub Job that queries a DB for updates, and if any are found, calls a Sub Job that integrates these to Formbird.
Repeater (Main Job) ==> DB Query (Sub Job) ==> Update Formbird (Sub Job)
Listeners / Webservices
Components such as tRestRequest
, and tESBProviderRequest
, can be used to setup webservice endpoints to listen for requests to action. These endpoints can be called from:
- Formbird to perform outbound integration to external systems; or
- an External system to perform inbound integration to Formbird.
As with Repeating events, it is recommended to setup the listeners in a Main job, which calls a Sub Job via a tRunJob
component to perform the primary task.
Listener (Main Job) ==> Processor/Filter (Sub Job) ==> Update Formbird (Sub Job)
Components
Select the Components to suit the task.
A sampling of Components available in Talend:
Purpose | Component |
---|---|
Polling | tInfiniteLoop |
SOAP | tESBProviderRequest (via Talend Services) |
REST | tRESTRequest, tRESTResponse |
DB | tOracleConnection, tOracleRow, tOracleClose |
Custom Code | tLibraryLoad, tJava, tJavaRow |
Custom Code Components
Talend provides custom code components such as tJava
, and tJavaRow
to provide the developer with complete control when developing their integration Jobs. These components allow the developer to embed functions / processing logic that would otherwise be unavailable using traditional components. The ability to call upon Code Routines and access External Java Libraries extends the capabilities of a Job substantially.
Integrating with Formbird
The Formbird Web Service Connector
can be included as a Java Library to any Jobs being developed that require integration with Formbird. The methods provided in the library allow a developer to access the Formbird Web API from Talend's Code Routines, and Custom Code components. The examples provided in this documentation use this method to integrate Formbird with Talend.
Refer to Code Routines and Embedded Code
for details on how to include the Java Library in your Jobs. Alternatively, the Library may be loaded directly into a Job by adding a tLibraryLoad
component to the Talend Job
. Once included you can begin using the library to interact with the Formbird API.
Add Logging to a Job
When using Talend's custom code components, you can add logging simply by adding the following code snippet:
// Setup logger
Logger logger = Logger.getLogger(context.loggerName);
String method = jobName + "." + currentComponent;
// Log example
logger.info(method + ".runMode: " + context.runMode);
Tip: Configure Talend's logger level to produce more verbose logging. For Talend Open Studio, navigate to "File | Edit Project properties | Log4j" to configure Talend Open Studio's console logger level. For Talend Runtime environment, edit the log configuration file residing in the following location:
C:\TalendStudio-621\Runtime_ESBSE\container\etc\org.ops4j.pax.logging.cfg