Petals-SE-Talend

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (43)

View Page History

Second, a job can be seen as *a set of transformation means*.
Indeed, Talend products provide _Talend components_ that are very efficient and convenient for transformations (e.g. the tMap component). However, it must be clear that these transformations only cover flat structures, like schemas of relational databases. Object or XML schemas are not covered. From this point of view, *the Petals-SE-Talend component cannot replace the Petals-SE-XSLT component*. But it can be an alternative in few cases. Hence, transformations will either rely on attachment files (these files content are of the attached files is transformed by the job) or on Talend components for Petals (known as _tPetalsInput_ and _tPetalsOutput_). The later solution provides a means to place the content to transform inside the XML message, rather than as an attachment. But still with constraints on the XML shape.

Eventually, the last way to apprehend a Talend job inside Petals, is to see it as a *an application to execute inside Petals*.
This application may work with data stores (files, databases...), may involve data transformations, but may also use other (if not redundant with Petals) features. As an example, it is possible to send mails inside a job, connect to FTPs, etc... Obviously, these features are also available inside Petals. But in some cases, it can be more interesting and more simple to integrate them directly in the job than use the Petals'ones (where you will have to use EIPs or BPELs to link the calls). In some other cases though, the exact opposite may be the best option, i.e. externalize some parts to Petals components. *It all depends on the expected granularity and reusability*.

The wide variety of possibilities (allowed by the non-less important variety of _Talend components_, and by the features of the Petals-SE-Talend component) makes this solution a very flexible one. However, as a swiss-knife component, *the Petals-SE-Talend component should mainly be seen as a functional service-engine*. Performances, without being bad, cannot be the best ones offered. People looking for a very specific and performant usage will prefer develop their own Petals component, or use Petals-SE-Pojo or Petals-SE-Jsr181 components.



When a request is received and started to be processed in the Petals-SE-Talend component, it is validated before being really processed.

Here are the different steps involved in this validation process.

The first step is the WSDL-based validation of the request's XML payload.
If the *validate-exchange-by-wsdl* parameter is set to *true*, either in the component or in the service-unit, then the XML payload is validated against the WSDL of the service-unit.
If the validation fails, a fault is raised. Otherwise, the validation goes on.
If the validation fails, an exception is thrown (which becomes either fault or an error, dependending on the Messsage Exchange Pattern). Otherwise, the validation goes on.

{warning}

\\
Besides, it must be noticed that this component only supports *InOut* pattern.
No other pattern is or will be supported, unless the component undergoes a severe refactoring. It is up to the client to manage the call correctly.
This component supports *InOut*, *InOnly* and *RobustInOnly* patterns.




If the job is singleton and already running, then a fault an exception (fault or error) is raised.
Otherwise, a new job instance is created. If the job is singleton, then the running state of this job is set to true and locked until it is this state is released (i.e. the job is executed).

\\
{note} {info}

The job creation strategy is a lazy strategy. A job instance is created on every received and validated message.
The consequence for singleton jobs is that all the messages sent to a singleton job while it is running will be rejected.
{note} {info}




{note} {info}
If a job does not support to be passed data flow (for a tPetalsInput), an entry is logged, but no fault is raised. The execution goes on normally.
{note} {info}

\\
Notice that the input message may not define any of these parameters. In this case, the component will pass nothing to the job.

{note} {info}
In fact, the WSDL content and the expected parameters depend on the job's content and on the defined options during the export operation.
{note} {info}


The native job's output is an array of array of String, that is to say: {code:lang=java}String[][]{code}
This result may contain only an integer, in which case {code:lang=java}String[ 0 ][ 0 ]{code} is an integer and indicates the result of the job execution. Otherwise, this array contains raw data (which is the case if the job contains a tBufferOutput).
This can be a solution to determine whether the job execution succedded or not. The Petals-SE-Talend does not do it. It is the responsibility of the client to make this check (since in fact, it depends on the job itself).

Checking it can be a solution to determine whether the job execution succedded or not. The Petals-SE-Talend does not do it. It is the responsibility of the client to make this check (since in fact, it depends on the job itself).

\\
If the job contained a tPetalsOutput, then the output data flow is retreived from the job.

{note} {info}
If a job does not support to be asked data flow (for a tPetalsOutput), an entry is logged, but no fault is raised. The execution goes on normally.
{note} {info}

\\

Like input attachments, output attachments are returned in MTOM mode.
{note} {info}

If a component expects output attachments to be returned by the job, and that this job does not support it, then a fault is an exception (fault or error)is thrown.
This can typically happen if you created your job with Talend Open Studio and exported a context as an "OUT-Attachment".
{note} {info}



Two products can be used to create Talend jobs and export them into Petals: Talend Open Studio, which is an open source product, and Talend Integration Suite, which is the upgraded version of Talend Open Studio (but not free).
There are slight differences between what can be made in with these two products.

h2. Talend Open Studio

Talend Open Studio does not support any specific component for Petals.
It Talend Open Studio supports the following features for the Petals-SE-Component:
* Expose a context as a parameter into the service's WSDL.
* Pass attachment files to a job.

Other features are only supported by Talend Integration Suite.
In particular, it does not support any specific component for Petals.
However, it is possible to use alternative ways, depending on the desired feature. behavior.




* You can use tPetalsInput and tPetalsOutput components in your jobs.
* tPetalsInput and tPetalsOutput components can be used in a job.
** These components respectively allow you to pass data from Petals to the job and from the job to Petals.
** These two components do not have any specific parameter. They just need their schema to be defined.
* You can simulate the Petals behavior for these two components, meaning you can execute your job in Talend Integration Suite if it contains a tPetalsInput or a tPetalsOutput component.
** Thus, for a tPetalsInput, you can provide what would be the Petals input from a file that will be loaded before the simulation.
* The Petals behavior can be simulated for these two components. It means a job created in Talend Integration Suite which would contain a tPetalsInput or a tPetalsOutput component, can be executed inside Talend Integration Suite.
** Thus, for a tPetalsInput, the Petals input message can be mocked by (loaded from) an XML file during the simulation.
** For the tPetalsOutput, the returned document will be printed into the console.
* Eventually, Talend Integration Suite allows to attach files in the responses.

\\
Here is a sample job using tPetalsInput and tPetalsOutput components.
This job simply takes an input message from Petals and transforms it before returning it in the bus.

!tPetalsInputOutput.jpg!


h2. Limitations


\\
About the tPetalsInput or the and tPetalsOutput components:
* A job can contain several instances of any of these components.



Here is a snapshot version of the Talend export for Petals.

{center}
!SimpleJobExport.jpg! !FinalTalendExportForPetals_1.jpg!
{center}


{center}
!SimpleJobExportContext1.jpg! !FinalTalendExportForPetals_2.jpg!
{center}

When this link is clicked, a dialog shows up.
It lists all the job contexts, context variables from the job, with their name, the type they will be associated with if exported, and the way they are exported.
By default, no context is exported. Said differently, the export mode for all the contexts is *Not exported*.

\\
\\
Beware, for the moment, WSDL-based validation does not work with messages having attachments. \| false \| false \|

\\


The service unit must contain the JAR archives of the job and its dependencies, plus JAR file containing all the contexts.. context files.
It is also highly recommended to provide a WSDL description of your job. This WSDL is not mandatory, but not providing it will prevent your service from interacting with other Petals services and components.
By default, a WSDL is generated during the Talend export for Petals.
+ src
- { source files }
+ { Contexts directory }
- *.properties
- JobName.wsdl
- contexts.jar
- systemRoutines.jar
- userRoutines.jar