|
Key
This line was removed.
This word was removed. This word was added.
This line was added.
|
Changes (32)
View Page History{section}
{column}
{column}
h1. Preliminary notes
This use case can be reproduced with both Talend Open Studio and Talend Integration Suite.
It is an alternative way to undertake what is done in the use case "Data Flow - From Petals to a job using a tPetalsInput".
This use case can be reproduced with both Talend Open Studio and Talend Integration Suite.
It is an alternative way to undertake what is done in the use case "Data Flow - From Petals to a job using a tPetalsInput".
{column}
{column:width=360px}
{panel}{toc}{panel}
{column}{section}
{column:width=360px}
{panel}{toc}{panel}
{column}{section}
h1. Rationale
Execute a Talend job into Petals and passing it a context as a parameter described in the service's WSDL interface.
The resulting file will be returned as an attachement
The resulting file will be returned as an attachement
Send a file as an attachment through Petals to a Talend job.
The job loads the content of the attached file and inserts its content into a database.
In the scope of this use case, we could imagine, even if it is not shown, that the file's content is transformed before being inserted.
The job loads the content of the attached file and inserts its content into a database.
In the scope of this use case, we could imagine, even if it is not shown, that the file's content is transformed before being inserted.
The job is exposed as a service into Petals. When this service is called, the parameter is passed to the job, which is then executed.
The file created by this job is then returned as an attchment.
The file created by this job is then returned as an attchment.
The input message provides the value of of the context which is exposed as a parameter in the service's interface.
The input message provides the attachment file.
Only the job's result is expected in the response.
The job to be executed performs the following actions:
# The job is passed the value of the context variable.
# The job is passed the file whose content must be inserted. The file is passed as an attachment to the message.
# The job loads the file's content.
# The job loads the file's content.
# The job connects to a database and writes the data in this database.
# It retrieves the content of a table.
# It serializes part of the extracted data as a CSV file on the disk.
# Once the execution terminated, the created file is attached to the returned message.
# It serializes part of the extracted data as a CSV file on the disk.
# Once the execution terminated, the created file is attached to the returned message.
This job has one context variable, which indicates the location of the CSV file.
This location will be read by the Petals-SE-Talend component once the execution is terminated. The file will then be attached to the returned message.
This location will be read by the Petals-SE-Talend component once the execution is terminated. The file will then be attached to the returned message.
This job has one context variable, pointing to the location of the file whose content must be loaded.
\\
{info}
{info}
In the scope of this use case, it is assumed there is a database "formationtalend" *formationtalend* on the localhost, having a table named *customers*.
The schema of the *customers* table includes two columns named "CustomerName" *CustomerName* and *CustomerAddress*, both being of type varchar(255).
{info}
h2. Creating the job
The job creation is detailled in the use case "A Simple Talend Job".
There is no difference.
There is no difference.
h2. Exporting the job
Select the job and right-click it. Select *Export to Petals ESB*.
Update the target destination.
Let the job be exposed as a singleton.
Update the target destination.
Let the job be exposed as a singleton.
Click *Edit the exposed contexts*.
A dialog shows up. Export the _outputLocation_ context as an *Out-Attachment*.
You should have the following dialog:
Click the *Export mode* column, and select *Parameter* in the combo box. Click *OK*.
The link label should be updated and indicate the number of exported contexts.
Click *Finish*.
A dialog shows up. Export the _outputLocation_ context as an *Out-Attachment*.
You should have the following dialog:
Click the *Export mode* column, and select *Parameter* in the combo box. Click *OK*.
The link label should be updated and indicate the number of exported contexts.
Click *Finish*.
h1. Deploying and testing in Petals
h2. Looking at the created archive generated WSDL
The created archive is a Petals service assembly.
More details are available in the documentation of the petals-SE-Talend.
More details are available in the documentation of the petals-SE-Talend.
In the created Petals service assembly, the most interesting thing to look at is the WSDL.
Indeed, the WSDL will determine the way the exported service will be called.
Indeed, the WSDL will determine the way the exported service will be called.
What must be taken care of is the jbi.xml and the WSDL files available in the service-unit.
If you open the created archive, it contains another archive. This second archive contains a jbi.xml file.
If you open the created archive, it contains another archive. This second archive contains a jbi.xml file.
\\
The input message's description requires empty parameters.
The input message's description requires empty parameters.
The WSDL file exposes no parameter.
The possible input parameters are:
The possible input parameters are:
{code:lang=xml}
{code}
\\
And the output message includes the job's result and the output attachment.
{code:lang=xml}
{code}
\\
And the output message includes the job's result and the output attachment.
{code:lang=xml}
{code}
h2. Deploying and testing this new service
SoapUI is used for this test...
Since we use attachments, we will prefer using a Java client instead of SoapUI.
However, it is possible to use SoapUI to send or receive messages with attachments. Just make sure the MTOM property is activated.
The first thing to do is to create a service-unit for the Petals-BC-SOAP component, that exposes (consumes) our _Talend job as a service_ outside the bus.
This step is not described here. You can take a look at the Petals-BC-SOAP documentation and the Petals Studio documentation.
Just make sure the SOAP configuration uses the InOut MEP.
Then, to generate a client from the WSDL, you can use Apache CXF or Axis2.
In the scope of this use case, Apache CXF is used. Only the client class is shown here.
\\
The client's coe is the following:
{code:lang=java}
TODO
{code}
\\
Notice that the MTOM-mode was activated. Not enabling it will result in errors.
\\
The execution output is:
{panel}
{panel}
\\
If the job execution fails, the 0 is replaced by another integer, e.g. 1.
One failure reason can be, as an example, that the database is not started.
To determine the act cause of a problem, you would have to use logging features available in the Talend palet.
However, let's make it clear, the job's logs are managed independently of Petals and its monitoring capabilities.
However, it is possible to use SoapUI to send or receive messages with attachments. Just make sure the MTOM property is activated.
The first thing to do is to create a service-unit for the Petals-BC-SOAP component, that exposes (consumes) our _Talend job as a service_ outside the bus.
This step is not described here. You can take a look at the Petals-BC-SOAP documentation and the Petals Studio documentation.
Just make sure the SOAP configuration uses the InOut MEP.
Then, to generate a client from the WSDL, you can use Apache CXF or Axis2.
In the scope of this use case, Apache CXF is used. Only the client class is shown here.
\\
The client's coe is the following:
{code:lang=java}
TODO
{code}
\\
Notice that the MTOM-mode was activated. Not enabling it will result in errors.
\\
The execution output is:
{panel}
{panel}
\\
If the job execution fails, the 0 is replaced by another integer, e.g. 1.
One failure reason can be, as an example, that the database is not started.
To determine the act cause of a problem, you would have to use logging features available in the Talend palet.
However, let's make it clear, the job's logs are managed independently of Petals and its monitoring capabilities.