cTalendJob
Exchanges messages between a Data Integration Job and a Mediation
Route.
cTalendJob calls a Data
Integration Job either from the repository or exported as an OSGI
Bundle For ESB. For more information on how to build a Job and how
to export a Job as an OSGI Bundle for ESB, see
Talend Studio User Guide.
cTalendJob Standard properties
These properties are used to configure cTalendJob running in the Standard Job framework.
The Standard
cTalendJob component belongs to the Talend family.
Basic settings
Repository |
Select this option to call a Job from the Repository. |
External | Select this option to call a Job that is exported as an OSGI Bundle For ESB. |
Repository/Use Selected Job Context | This field appears when Repository is selected. Select this check box to use the context that is selected in the Context list when executing the Job. |
Repository/Use Route Context Name |
This field appears when Repository is selected. Select this check box to use Note:
If context does not exist in the Job, null values of the |
Repository/Use Job Context | This field appears when Repository is selected. Select this check box to use the selected context on the Job side when executing the Job. |
Repository/Job |
This field appears when Repository is selected. Click […] to show the Assign
Job wizard. Choose between Create a new Job and Assign it to this cTalendJob component and Assign an existing Job to this cTalendJob component and follow the prompts. Warning:
When assigning an existing Job to cTalendJob, only the Jobs with the tRouteInput component can be You can double click cTalendJob to open the referenced |
Repository/Version | This field appears when Repository is selected. Select the version of the Job if more than one version of the Job is available. |
Repository/Context |
This field appears when Repository is selected. Select from the list the Warning:
This option works only when Use |
External Jar/Library |
This field appears when External |
External Jar/Job |
This field appears when External |
External Jar/Context |
This field appears when External |
Context Param |
Use this table to change the variable values of the specified Click [+] to add as many rows as |
Advanced settings
Propagate Header | Select this check box to pass the message header to the referenced Job as a context variable. |
Fast Job Invocation | Select this check box to bind the life cycle of the embedded Talend Job to the start and stop state changes of the connected Talend Camel Endpoint. When the Route is started, the endpoint for the embedded Job is
also started, and the Job instance is created and ready for receiving message exchanges. With this option enabled, while the Route is active, the embedded Job keeps long-living resources and refreshes short-living resources between invocations. In this case the database access objects are only kept connected while data are sent or received, which avoids overhead and performance loss with Jobs containing database assess resources that are expensive on creation. Warning:
Due to the variety of possible Jobs, there is no warranty that a specific Warning:
In combination with the Fast Job Invocation |
Usage
Usage rule |
cTalendJob can be a start, middle |
Limitation |
 n/a |
Using cTalendJob to call a DI Job
This scenario applies only to Talend Open Studio for ESB, Talend Data Services Platform and Talend Data Fabric.
In this scenario, we will build a Data Integration Job with context first. Then, we will
create a Route with a cTalendJob component to call the
Job and set the context variables in the Job.
Creating an Data Integration Job
In this section, we will build a Job named RouteCommunication
to accept the message from a Route. For more information on how to build a Job, see
Talend Studio User Guide.
Dropping and linking the components
-
Drag and drop a tRouteInput and a
tLogRow from the Palette onto the design workspace. -
Right-click the tRouteInput
component, select Row > Main from the contextual menu and click the
tLogRow component.
Configuring the components
-
Create two variables,
header
andbody
in the
Default
context group. Give the value
world
to thebody
variable. The
header
variable will receive its value propagated from
the Route. For more information about context setup, see
Talend Studio User Guide. -
Double-click the tRouteInput
component to open its Basic settings
view in the Component tab. -
Click […] next to Edit Schema. In the schema dialog box, click
[+] to add two lines of String type and name themheader
andbody
respectively. Click OK to close the dialog box. -
In the Simple Expression field for
theheader
element, entercontext.header
to
use the variableheader
in the context group which will be
propagated from the Route.In the same field for thebody
element, enter
context.body
to use the variablebody
in
the context group as the message body. -
The tLogRow component will monitor
the message exchanges and does not need any configuration. - Press Ctrl+S to save your Job.
Creating a Mediation Route
In this section, we will create a Route to send a message to the Job.
Arranging the flow of the message
- Drag and drop a cTimer, a cSetHeader, and a cTalendJob from the Palette onto the design workspace.
-
Link the components with the Row >
Route connection as shown
above. - Label the components for better identification of their roles.
Configuring how the message is processed
-
Double-click the cTimer component to
open its Basic settings view in the
Component tab. -
Set the values for the Period
(200), Repeat (1) and
Delay (1000) fields as shown above to trigger a message
exchange after a delay of 1000 milliseconds. -
Double-click the cSetHeader component
to display its Basic settings view in
the Component tab. -
Click [+] to add a row to the
Headers table.In the Name field, type in
"header"
as the header name.Select Constant in the Language list, and enter
"FileName"
in the Value field. -
Double-click the cTalendJob component
to display its Basic settings view in
the Component tab. -
Select Repository to call a Job from
the repository. -
In the Repository Job area, select
Use Selected Context.Click […] next to the Job field to open the Assign
Job wizard. Select Assign an
existing Job to this cTalendJob component and click
Next.In the Job selection view, select
RouteCommunication
that we just created in the
Job designs tree view and click
Finish.RouteCommunication
is now displayed in the Job field. By default, the latest version and
the default context of it is selected. -
Click [+] under the Context Param to add a row to it.
The Parameters list contains the
variables in the default context group of the referenced Job. Select
body
in the list.Enter"Hello World!"
in the Values field. It will replace the value
world
that is defined in the Job context. -
Click the Advanced settings view.
Select the Propagate Header check box
to pass the header that is defined in cSetHeader to the Job as a context variable. -
Press Ctrl+S to save your
Route.
Viewing the code and executing the Route
-
Click the Code tab at the bottom of the
design workspace to check the generated code.As shown above, a message route is built from theStarter
,
set a messageheader
by thecSetHeader
, and then
sent tocTalendJob
for the execution of the Job. -
Press F6 to execute the Route.
As shown above, the header and body of the message is printed in the
execution console by the tLogRow. The
header value isFileName
. It is defined by the cSetHeader and passed to the Job as a context
variable. The body value isHello World!
. It is defined by
tRouteInput using the context variable
body
of the Job. The value for this variable is set as
world
in the Job, but changed toHello World!
in cTalendJob.