<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Is tSalesforceOutput thread safe? in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Is-tSalesforceOutput-thread-safe/m-p/2313040#M83932</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Yes I tried the tFlowToIterate pattern with the same result.&lt;/P&gt; 
&lt;P&gt;In this example I've tried running 4 in parallel but by splitting the flow using a randomly assigned number.&amp;nbsp; when I set the enable parallel execution on the iterate links and set the number to &amp;gt;1 I get the error mentioned in my post.&lt;/P&gt; 
&lt;P&gt;The tMaps doing the lookup to salesforce to get the attachment data are operating in the reload each row mode to query for a specific salesforce record each time.&lt;/P&gt;&lt;BR /&gt;&lt;A href="https://community.qlik.com/legacyfs/online/tlnd_dw_files/0683p000009LvgJ"&gt;PutAttachmentParallelTest_0.3.png&lt;/A&gt;</description>
    <pubDate>Tue, 21 May 2019 11:13:20 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-05-21T11:13:20Z</dc:date>
    <item>
      <title>Is tSalesforceOutput thread safe?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Is-tSalesforceOutput-thread-safe/m-p/2313038#M83930</link>
      <description>&lt;P&gt;I am trying to streamline the loading of ContentVersion records (attachments) to salesforce by using a tFlowtoIterate with enable parallel execution to parallelize a call to a child job. I have also tried this without a child job and got the same result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ContentVersions have to be loaded serially into salesforce, they can't be grouped in to batches greater than 1 record owing to various restrictions in salesforce.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I am trying to work around this by setting up many threads all running a single record into salesforce.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To start with the job runs very fast with multiple threads executing to load into salesforce. However after n records the tSalesforceOutput component fails with the following string index error.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This error does not occur if I set the tRunJob to use separate processes for each execution however the overhead of setting up a new process for each iteration slows the process down so much it is no faster than the serial method.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I suspect that something in tSalesforceOutput is not thread safe.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Has anyone seen this behaviour before or know if my hunch is correct?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;----&lt;/P&gt;
&lt;P&gt;Exception in component tRunJob_1 (PutAttachmentParent)&lt;BR /&gt;java.lang.RuntimeException: Child job running failed.&lt;BR /&gt;java.lang.StringIndexOutOfBoundsException: String index out of range: -8&lt;BR /&gt;at ihs.putattachmentparent_0_3.PutAttachmentParent$1tRunJob_1Thread.run(PutAttachmentParent.java:4970)&lt;BR /&gt;at routines.system.ThreadPoolWorker.runIt(TalendThreadPool.java:159)&lt;BR /&gt;at routines.system.ThreadPoolWorker.runWork(TalendThreadPool.java:150)&lt;BR /&gt;at routines.system.ThreadPoolWorker.access$0(TalendThreadPool.java:145)&lt;BR /&gt;at routines.system.ThreadPoolWorker$1.run(TalendThreadPool.java:122)&lt;BR /&gt;at java.lang.Thread.run(Unknown Source)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;----Here is the exception log if I don't use a child job&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;18:30:37,049 INFO [SalesforceWriter] Done.&lt;BR /&gt;18:31:26,508 INFO [SalesforceWriter] Prepare to insert record 1.&lt;BR /&gt;18:31:27,250 INFO [SalesforceWriter] Has inserted record 1 successfully.&lt;BR /&gt;18:31:27,250 INFO [SalesforceWriter] Has inserted 1 records successfully.&lt;BR /&gt;18:31:27,250 INFO [SalesforceWriter] Has rejected 0 records.&lt;BR /&gt;18:31:27,250 INFO [SalesforceWriter] Done.&lt;BR /&gt;18:31:27,828 INFO [SalesforceWriter] Failed to insert record 1.&lt;BR /&gt;18:31:27,828 INFO [SalesforceWriter] Has inserted 1 records successfully.&lt;BR /&gt;18:31:27,828 INFO [SalesforceWriter] Has rejected 1 records.&lt;BR /&gt;18:31:27,828 INFO [SalesforceWriter] Done.&lt;BR /&gt;Exception in component tSalesforceOutput_1 (PutAttachmentParallel)&lt;BR /&gt;java.lang.StringIndexOutOfBoundsException: String index out of range: 13&lt;BR /&gt;at java.lang.String.substring(Unknown Source)&lt;BR /&gt;at java.text.MessageFormat.subformat(Unknown Source)&lt;BR /&gt;at java.text.MessageFormat.format(Unknown Source)&lt;BR /&gt;at java.text.Format.format(Unknown Source)&lt;BR /&gt;at org.talend.daikon.i18n.I18nMessages.getFormattedMessage(I18nMessages.java:63)&lt;BR /&gt;at org.talend.daikon.i18n.ClassBasedI18nMessages.getMessage(ClassBasedI18nMessages.java:76)&lt;BR /&gt;at org.talend.components.salesforce.runtime.SalesforceWriter.getPastForm(SalesforceWriter.java:738)&lt;BR /&gt;at org.talend.components.salesforce.runtime.SalesforceWriter.handleSuccess(SalesforceWriter.java:511)&lt;BR /&gt;at org.talend.components.salesforce.runtime.SalesforceWriter.doInsert(SalesforceWriter.java:351)&lt;BR /&gt;at org.talend.components.salesforce.runtime.SalesforceWriter.insert(SalesforceWriter.java:328)&lt;BR /&gt;at org.talend.components.salesforce.runtime.SalesforceWriter.write(SalesforceWriter.java:185)&lt;BR /&gt;at ihs.putattachmentparallel_0_3.PutAttachmentParallel$1tDBInput_2Thread.run(PutAttachmentParallel.java:8802)&lt;BR /&gt;at routines.system.ThreadPoolWorker.runIt(TalendThreadPool.java:159)&lt;BR /&gt;at routines.system.ThreadPoolWorker.runWork(TalendThreadPool.java:150)&lt;BR /&gt;at routines.system.ThreadPoolWorker.access$0(TalendThreadPool.java:145)&lt;BR /&gt;at routines.system.ThreadPoolWorker$1.run(TalendThreadPool.java:122)&lt;BR /&gt;at java.lang.Thread.run(Unknown Source)&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 19:34:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Is-tSalesforceOutput-thread-safe/m-p/2313038#M83930</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-16T19:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: Is tSalesforceOutput thread safe?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Is-tSalesforceOutput-thread-safe/m-p/2313039#M83931</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;The Salesforce output component actually works better with a tFlowToIterate component placed in front. Could you please show us your current job design screenshots? Did you use global variables(Put, Get) in your work flow?&lt;/P&gt;
&lt;P&gt;Best regards&lt;/P&gt;
&lt;P&gt;Sabrina&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 09:02:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Is-tSalesforceOutput-thread-safe/m-p/2313039#M83931</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-21T09:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: Is tSalesforceOutput thread safe?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Is-tSalesforceOutput-thread-safe/m-p/2313040#M83932</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Yes I tried the tFlowToIterate pattern with the same result.&lt;/P&gt; 
&lt;P&gt;In this example I've tried running 4 in parallel but by splitting the flow using a randomly assigned number.&amp;nbsp; when I set the enable parallel execution on the iterate links and set the number to &amp;gt;1 I get the error mentioned in my post.&lt;/P&gt; 
&lt;P&gt;The tMaps doing the lookup to salesforce to get the attachment data are operating in the reload each row mode to query for a specific salesforce record each time.&lt;/P&gt;&lt;BR /&gt;&lt;A href="https://community.qlik.com/legacyfs/online/tlnd_dw_files/0683p000009LvgJ"&gt;PutAttachmentParallelTest_0.3.png&lt;/A&gt;</description>
      <pubDate>Tue, 21 May 2019 11:13:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Is-tSalesforceOutput-thread-safe/m-p/2313040#M83932</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-21T11:13:20Z</dc:date>
    </item>
  </channel>
</rss>

