Petals-SE-Talend

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

Changes (58)

View Page History
{section}{column}

h1. Features

However, which one of these tool created the configuration is not important for this service-engine.

The configuration by itself includes both the jbi.xml file and the WSDL describing the service.


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 (the job is executed).

{note}

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}


Once accepted, the request can now be parsed to prepare the job's input.

## Be careful, attachments are expected to be passed in MTOM mode. That is to say the attachment element has a grand-child element "xop:include" whose href attribute references an attachment.
## Besides, the name of the attachment element is the name of the context variable that will be associated with the temporary file location.
# Eventually, the component processes the native options to be passed to the job.


{note}


As a user, you do not have to worry about this complexity. The configuration and the WSDL creation are made by the tools, during the export.
And the clients can be generated automatically from the WSDL.
# Eventually, the component processes the native options to be passed to the job.

{note}

{note}

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}


From one JBI message (an XML payload and attachments), the Petals-SE-Talend component gets at most 4 kind of parameters to pass to the jobs.
Three of them are merged together, since they are passed as contexts to the job. The remaining one concerns the tPetalsInput data.
If the job contained a tPetalsOutput, then the output data flow is retreived from the job.

{note}

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

{note}


Eventually, if it was specified during the job export that output attachments are to be expected after the job was executed, then they are taken back from the job.
These attachments must be passed from the job to the component through files. These files are then loaded by the component in memory and then, deleted from the disk.

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

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

{note}




h2. Building the response

Like the input message, the structure of the output message is determined by the job content and the options which were checked during the export of the job for Petals.

h2. Notes

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.


If a job does not support to be passed data flow (for a tPetalsInput) or asked data flow (for a tPetalsOutput), an entry is logged, but no fault is raised. The execution goes on normally.
If a component expects output attachments to be returned by the job, and that this job does not support it, then a fault is thrown. This can typically happen if you created your job with Talend Open Studio and exported a context as an "OUT-Attachment".


h1. Talend Open Studio vs. Talend Integration Suite


The export options are the following:
* Singleton job: true to make the job singleton. A singleton job can have only one instance running at once on a given Petals-SE-Talend component.
* Generate the end-point: true to let Petals generate the end-point at deployment time. If false, the end-point name is the job name with the suffix "Endpoint".
* Validate Petals messages: true to validate all the messages / requests against the WSDL.
* User routines: embed the user routines in the service-unit.
* Source files: true to embed the source files in the generated service-unit.
* Jobs contexts: select the context that will be used by default by the job.

|| Export Option || Description ||
| Singleton job | True to make the job singleton. A singleton job can have only one instance running at once on a given Petals-SE-Talend component. |
| Generate the end-point | True to let Petals generate the end-point at deployment time. If false, the end-point name is the job name with the suffix "Endpoint". |
| Validate Petals messages | True to validate all the messages / requests against the WSDL. \\
Be careful, enabling this option reduces the performances (disk access). \\ |
| User routines | Embed the user routines in the service-unit. |
| Source files | True to embed the source files in the generated service-unit. |
| Jobs contexts | Select the context that will be used by default by the job. |

Eventually, there is the edition link to specify how contexts should be exposed in the.generated WSDL.

!SimpleJobExportContext1.jpg!

When this link is clicked, a dialog shows up.
It lists all the job contexts, 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 of all the contexts is NOT_EXPORTED. *Not exported*.

Here is a small description of the export modes.
* Not exported: the context is not exported (not visible as a parameter). But the context can still be overridden using the native parameters of the job.
* Parameter: the context is exported as a parameter in the contexts.
* In-Attachment: the context will be passed the location of a temporary file whose content was passed as an attachment in the input message.
* Out-Attachment: the context will be read after the job was executed.
** This context must point to a file.
** The file content will be read by the Petals-SE-Talend component and put as an attachment into the response. 
** The context name will be used as the attachment name.
** The file will be deleted by the component right after its content was loaded.
* Parameter and Out-Attachment: a mix between the Parameter and the Öut-Attachement modes.
** The context is exposed as a parameter.
** It will also be read after the job execution.
** The file will be deleted anyway.
** The advantage of this export mode if to insert more dynamicity in the output file.

|| Export Mode || Description ||
| Not exported | The context is not exported (not visible as a parameter). But the context can still be overridden using the native parameters of the job. |
| Parameter | The context is exported as a parameter in the contexts. |
| In-Attachment | The context will be passed the location of a temporary file whose content was passed as an attachment in the input message. |
| Out-Attachment | The context will be read after the job was executed.
* This context must point to a file.
* The file content will be read by the Petals-SE-Talend component and put as an attachment into the response. 
* The context name will be used as the attachment name.
* The file will be deleted by the component right after its content was loaded. |
| Parameter and Out-Attachment | A mix between the Parameter and the Out-Attachement modes.
* The context is exposed as a parameter.
* It will also be read after the job execution.
* The file will be deleted anyway.
* The advantage of this export mode if to define the output file destination dynamically. |

h2. The WSDL structure for Talend service-units

h2. Execute a Talend job when a message is received

When a JBI message is received on an endpoint linked to a Talend job, the following actions are performed by the component:
# If the validate-by-wsdl action is enabled in the component or in the service-unit, then the message is validated with respect to the service's WSDL.
# If the job is not singleton, or if it is not already running, the a new job instance is created.
## If the running state could not be acquired, then a fault is thrown.
## If the job is singleton, then no other request to this service will be accepted until it was executed.
# The exported contexts are searched into the received message. They will be passed to the job when its main method is called.
# Data flow intended for a tPetalsInput component are retrieved from the JBI message.
# The input attachments are searched. Input attachments are referenced in the JBI message, while the attachments themselves are attached to this message.
## Every attachment is serialized as a tempoary file.
## The file location will be passed as a context variable to the job.
# Eventually, the Talend's options are processed. These parameters are the native parameters of a Talend job.
# The
The way the Petals-SE-Talend component processes a message in described in the first section of this document.


!petals-bc-ejb.png!


The RMI message is created following these steps :
# The JBI message payload is mapped to Java objects. These objects (and their types) are used as operation parameters for the RMI call. The mapping is done thanks to the PEtALS-JAXB-Databinding library. For more information about XML databinding feel free to read the chapter entitled XML to Java binding.
# The JBI message exchange operation local part is used as the EJB method to invoke.
# If a security subject is provided by the JBI message it is used as authentication information during the RMI invokation.

{info}
For more information about JAAS read the chapter : JAAS authentication for EJB calls
{info}

In order to reach the remote EJB, the component need to get an RMI stub of the EJB from a JNDI server. The JNDI name of the target EJB is defined in the parameter ejb.jndi.name.

The external EJB is called and the response is processed by the PEtALS-JAXB-Databinding library and then returned to the JBI environment.

h2. Service Unit descriptor

The Service Unit descriptor file ( jbi.xml ) looks like this :
{code:lang=xml}<!-- Remember, this file is intended to be generated by Talend Open Studio or Talend Integration Suite -->
{code:lang=xml}<?xml version="1.0" encoding="UTF-8"?>

<!--
JBI descriptor for the PEtALS' "petals-bc-ejb" component (EJB).
Originally created for the version 1.1 of the component.
-->

<jbi:jbi version="1.0"
xmlns:ejb="http://petals.ow2.org/components/ejb/version-1.1"
xmlns:generatedNs="http://application.localisation.watersupply.petals.ow2.org/"
xmlns:jbi="http://java.sun.com/xml/ns/jbi"
xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-4.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    xmlns:jbi="http://java.sun.com/xml/ns/jbi"
    xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5"
    xmlns:talend="http://petals.ow2.org/components/talend/version-1"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<!-- Import a Service into PEtALS or Expose a PEtALS Service => use a BC. -->
<jbi:services binding-component="true">
    <jbi:services binding-component="false">
        <jbi:provides
            interface-name="generatedNs:AttachmentInOutServicePortType"
            service-name="generatedNs:AttachmentInOutService"
            endpoint-name="AttachmentInOutEndpoint"
            xmlns:generatedNs="http://petals.ow2.org/talend/">

<!-- Import a Service into PEtALS => provides a Service. -->
<jbi:provides
interface-name="generatedNs:LocalisationFinderBusinessServicePortType"
service-name="generatedNs:LocalisationFinderBusinessService"
endpoint-name="LocalisationFinderBusinessServiceEndpoint">
            <!-- CDK parameters -->
            <petalsCDK:wsdl>AttachmentInOut.wsdl</petalsCDK:wsdl>
            <petalsCDK:validate-wsdl>true</petalsCDK:validate-wsdl>
            
            <!-- Component parameters -->
            <talend:name>AttachmentInOut</talend:name>
            <talend:class-name>talenddemosjava.attachmentinout_0_1.AttachmentInOut</talend:class-name>
            <talend:context>Default</talend:context>
            <talend:singleton>true</talend:singleton>
            <talend:validate-exchange-by-wsdl>false</talend:validate-exchange-by-wsdl>

<!-- CDK specific elements -->
<petalsCDK:wsdl>Localisation.wsdl</petalsCDK:wsdl>
<!--
<!-- Component specific elements -->
<ejb:ejb.jndi.name>LocalisationFinderBusinessService</ejb:ejb.jndi.name>
<ejb:java.naming.factory.initial>org.jnp.interfaces.NamingContextFactory</ejb:java.naming.factory.initial>
<ejb:java.naming.provider.url>jnp://localhost:1099/</ejb:java.naming.provider.url>
<ejb:ejb.version>2.1</ejb:ejb.version>
<ejb:ejb.home.interface>org.ow2.petals.watersupply.localisation.application.LocalisationFinderBusinessServiceRemoteHome</ejb:ejb.home.interface>
<ejb:marshalling.engine>jaxb</ejb:marshalling.engine>
<ejb:security.name />
<ejb:security.principal />
<ejb:security.credencials />
Define all the expected output attachements.
There can be as many "output-attachment" as required.
-->
</jbi:provides>
</jbi:services>
            <talend:output-attachment>outputFile</talend:output-attachment>
        </jbi:provides>
    </jbi:services>
</jbi:jbi>

{code}

*Configuration of a Service Unit to expose an EJB onto a Talend job as a service into Petals ESB :*
{table-plus}






|| Parameter || Description || Default || Required ||
| ejb.jndi.name | The JNDI name of the targeted EJB | \- | Yes |
| java.naming.factory.initial | The name of the targeted JNDI Initial Context Factory | \- | Yes |
| java.naming.provider.url | The URL of the targeted JNDI service | \- | Yes |
| ejb.version | Implemention version of the targeted EJB. \\
Supported versions are 2.0, 2.1, 3.0 and 3.1 | \- | Yes |
| ejb.home.interface | Fully qualified name of the targeted EJB Home Interface. Used only \\
with ejb 2.0 and 2.1. \\
Fully qualified name of the targeted EJB Home Interface. Used only with ejb 2.0 and 2.1. | \- | No |
| security.name | Fully qualified name of the security module used. | \- | No |
| security.principal | Username | \- | No |
| security.credencials | Password | \- | No |
| marshalling.engine | The marshalling engine to use | jaxb | Yes |
| name | The job's name \\ | \- | Yes |
| class-name | The job's class name \\ | \- | Yes |
| context | The context to use (if invalid, the job will use the default context) \\ | \- | Yes |
| singleton | The singleton property \\ | \- | Yes |
| validate-exchange-by-wsdl | Validate the messages against the WSDLs' schemas | False | No \\ |
| output-attachment \\ | The name of a context variable that points to a file that must be attached to the returned message. \\
The cardinality for this element is 0-*. \\ | \- | No \\ |
{table-plus}

{include:0 CDK SU Provide Configuration}
\\
{include:0 CDK Interceptor configuration for SU}



The service unit must contain a JAR archive including the EJB Interface (and EJB Home Interface for a 2.x EJB) and all specific Java classes used by this interface.
The service unit must contain the JAR archives of the job and its dependencies, plus JAR file containing all the contexts..
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.

It is also highly recommended to provide a WSDL description of your EJB interface. This WSDL description will be used as Service Description for the JBI Endpoint linked to your EJB.

The directory structure of a SU for the BC-EJB must look Petals-SE-Talend looks like this :

{noformat}my-su-ejb.zip {noformat}su-talend-JobName-provide.zip
+ META-INF
- jbi.xml
+ src
- { The source files }
- my-ejb-wsdl-description.wsdl JobName.wsdl
- my-ejb.jar contexts.jar
- my-ejb-dependency1.jar systemRoutines.jar
- my-ejb-dependency2.jar userRoutines.jar
- JobName_JobVersion.jar
- JobDepenencies.jar (potentially, several JARs){noformat}


h2. Provider restrictions


h2. Provider usage{noformat}

h1.