Talend Salesforce Connector – modifying it for serial Bulk API mode

I know, I know, I said I wouldn’t keep on about the Salesforce BULK API, but this is a good tip to share. This time I would like to share the problem  I encountered during my integration process development using Talend Data Integration Studio and my solution. Feel free to read this post if you are not familiar with using the Salesforce BULK API in Talend.
I used tSalesforceBulkExec to upload 10000 records to Salesforce, and the number of rows in a batch was set 5000.
In Salesforce, the customer has a trigger that creates a new unique parent record (if it does not exist in Salesforce) for the record uploaded from Talend. During the upload, I encountered an error saying that the trigger failed to create an unique parent record.

The Problem

After spending a fair bit of time to troubleshoot the problem (phew…), I realized that the tSalesforceBulkExec component was using parallel mode. This caused the batches that I uploaded to Salesforce to be processed in parallel and  there were 2 records in different batches that were sharing the same parent record. The trigger was not able to identify the unique parent as the batches were processing in parallel.

The Solution

To overcome this, I thought of changing the BULK API concurrency mode to serial mode. However, Talend does not allow you to configure this option in the tSalesforceBulkExec component. So I had to modify the createJob() method in the SalesforceBulkAPI class.
private JobInfo createJob() throws AsyncApiException {
        JobInfo job = new JobInfo();
        if (OperationEnum.upsert.equals(operation)) {
        //add the concurrency mode here
        job = connection.createJob(job);
        // System.out.println(job);
        return job;
You can obtain the source of the SalesforceBulkAPI class in the <talend installation folder>/org.talend.designer.components.localprovider_5.0.1.r74687/components/tSalesforceBulkExec/salesforceBulkAPI.jar.
I hope this helps you if you ever encounter this issue.