Data Flow - From a Job to Petals using a tBufferOutput

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 cases "Data Flow - From a job to Petals using a tPetalsOutput" and "Data Flow - From a job to Petals using attachments".

Rationale

Generate a data flow in a job and send it inside Petals.

The input message provides nothing.
Only the job's result is expected in the response. It holds the generated data flow.

Creating and exporting the job

The job to be executed performs the following actions:

  1. The job generates a data flow.
  2. This data flow is sent into Petals.

This job has no context variable.

Creating the job

The job is made up of two components:

  1. The tRowGenerator generates the data flow.
  2. The tBufferOutput puts this data in the job's result, thus making it available in Petals.

Here is the overall aspect of the job.



Here is the schema and the generation settings for the tRowGenerator component.


Here is the schema of the tBufferOutput component.

Exporting the job

Select the job and right-click it. Select Export Job Scripts.
In the Export type combo, select Petals ESB.
Update the target destination and let the job be exposed as a singleton.

You should have the following dialog:

Click Finish.

Deploying and testing in Petals

Looking at the generated WSDL

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.


The input message's description expects no parameter.

<xs:element name="executeJob" type="tns:executeJob" />
<xs:complexType name="executeJob">
	<xs:sequence>
		<xs:element minOccurs="0" name="contexts" type="tns:talendContexts" />
		<xs:element minOccurs="0" name="in-attachments" type="tns:inAttachments" />
		<xs:element maxOccurs="unbounded" minOccurs="0" name="in-data-bean" type="tns:inRow" />
		<xs:element maxOccurs="unbounded" minOccurs="0" name="talend-option" type="xs:string" />
	</xs:sequence>
</xs:complexType>

<xs:complexType name="talendContexts">
	<xs:sequence>
	</xs:sequence>
</xs:complexType>

<xs:complexType name="inAttachments">
	<xs:sequence>
	</xs:sequence>
</xs:complexType>

<xs:complexType name="inRow">
	<xs:sequence>
	</xs:sequence>
</xs:complexType>


And the output message only includes the job's result.
It is the job's result which will contain the generated data flow.

<xs:element name="executeJobResponse" type="tns:executeJobResponse" />
<xs:complexType name="executeJobResponse">
	<xs:sequence>
		<xs:element minOccurs="0" name="talend-job-output" type="tns:talendJobOutput" />
	</xs:sequence>
</xs:complexType>

<xs:complexType name="talendJobOutput">
	<xs:sequence>
		<xs:element maxOccurs="unbounded" minOccurs="0" name="executionResult" nillable="true" type="ns1:stringArray" />
		<xs:element minOccurs="0" name="outAttachment" type="tns:outAttachments" />
		<xs:element maxOccurs="unbounded" minOccurs="0" name="outDataBean" nillable="true" type="tns:outRow" />
	</xs:sequence>
</xs:complexType>

<xs:complexType name="outAttachments">
	<xs:sequence>
	</xs:sequence>
</xs:complexType>

<xs:complexType name="outRow">
	<xs:sequence>
	</xs:sequence>
</xs:complexType>

Deploying and testing this new service

To test this service, you can use a tool like SoapUI.
This way, you can see what the XML messages look like.

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.


Now, your input message (in SoapUI) should look like this:

<soapenv:Envelope
            xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
            xmlns:tal="http://petals.ow2.org/talend/">

   <soapenv:Header/>
   <soapenv:Body>
      <tal:executeJob>
         <!--Optional:-->
         <tal:contexts/>
         <!--Optional:-->
         <tal:in-attachments/>
         <!--Zero or more repetitions:-->
         <tal:in-data-bean/>
      </tal:executeJob>
   </soapenv:Body>
</soapenv:Envelope>


The returned message, when everything works, looks like:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <tns:executeJobResponse
            xmlns:tns="http://petals.ow2.org/talend/"
            xmlns:jaxb="http://jaxb.dev.java.net/array"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

         <tns:talend-job-output>
            <tns:executionResult>
               <jaxb:item>pj6ySPq9ZsyyDCf</jaxb:item>
               <jaxb:item>88</jaxb:item>
            </tns:executionResult>
            <tns:executionResult>
               <jaxb:item>nUfyq4kbUJ8vBgw</jaxb:item>
               <jaxb:item>12</jaxb:item>
            </tns:executionResult>

            <!-- ... -->

            <tns:executionResult>
               <jaxb:item>hoVgFrBo3leVdaG</jaxb:item>
               <jaxb:item>97</jaxb:item>
            </tns:executionResult>
            <tns:outAttachment/>
         </tns:talend-job-output>
      </tns:executeJobResponse>
   </soapenv:Body>
</soapenv:Envelope>


If the job execution fails, then it should just return an integer, e.g. 1.

Labels

petals petals Delete
tutorial tutorial Delete
se se Delete
talend talend Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.