<NewJob>
job event handler supports passing an input payload to new job.
This is applicable when both parent and new jobs are of type outbound ENOVIA/3DExperience jobs, and the parent receives a response payload from some destination.
In this case, the response payload can be used as input.
An example configuration:
<Job>
...
<TransferData>
...
<Destinations>
<Http id="http-1" />
</Destinations>
</TransferData>
<Events>
<Success>
<!-- Uses response from destination http-1. -->
<NewJob copyObjectId="true" usesInput="true" inputFrom="http-1" jobcfg="tvc:jobcfg/MyJob.xml" />
</Success>
</Events>
</Job>
When a job receives an input, it can be utilized in different ways. One option is to use <InputContent>
fraction in a payload configuration to include and/or transform the input:
<Payload>
<InputContent>
<Transformer xslt="tvc:xslt/MyTransformer.xslt"/>
</InputContent>
</Payload>
The input payload is also accessible by custom job executors and Java payload fractions.
Below is a custom job executor that reads the input with the help of com.technia.tif.enovia.payload.PayloadUtils
utility class.
package com.acme.tif.executor;
import com.technia.tif.core.ExtractionException;
import com.technia.tif.enovia.job.EnoviaJob;
import com.technia.tif.enovia.job.JobExecutor;
import com.technia.tif.enovia.payload.PayloadData;
import com.technia.tif.enovia.payload.PayloadUtils;
import java.io.IOException;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
public class MyJobExecutor implements JobExecutor {
@Override
public void perform(EnoviaJob job) throws ExtractionException {
PayloadData data = PayloadUtils.getInputPayload(job);
try (InputStream in = data.getInputStream()) {
// TODO: Do something with the input stream, e.g:
String string = IOUtils.toString(in, data.getEncoding());
} catch (IOException e) {
throw new ExtractionException(e);
}
}
}