Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As SteveS said, the <code>csv-to-maps-transformer</code> might try to load the entire file to memory before process it. What you can try to do is split the csv file in smaller parts and send those parts to <code>VM</code> to be processed individually. First, create a component to achieve this first step:</p> <pre><code>public class CSVReader implements Callable{ @Override public Object onCall(MuleEventContext eventContext) throws Exception { InputStream fileStream = (InputStream) eventContext.getMessage().getPayload(); DataInputStream ds = new DataInputStream(fileStream); BufferedReader br = new BufferedReader(new InputStreamReader(ds)); MuleClient muleClient = eventContext.getMuleContext().getClient(); String line; while ((line = br.readLine()) != null) { muleClient.dispatch("vm://in", line, null); } fileStream.close(); return null; } } </code></pre> <p>Then, split your main flow in two</p> <pre><code>&lt;file:connector name="File" workDirectory="yourWorkDirPath" autoDelete="false" streaming="true"/&gt; &lt;flow name="CsvToFile" doc:name="Split and dispatch"&gt; &lt;file:inbound-endpoint path="inboxPath" moveToDirectory="processedPath" pollingFrequency="60000" doc:name="CSV" connector-ref="File"&gt; &lt;file:filename-wildcard-filter pattern="*.csv" caseSensitive="true" /&gt; &lt;/file:inbound-endpoint&gt; &lt;component class="it.aizoon.grpBuyer.AddMessageProperty" doc:name="Add Message Property" /&gt; &lt;component class="com.dgonza.CSVReader" doc:name="Split the file and dispatch every line to VM" /&gt; &lt;/flow&gt; &lt;flow name="storeInDatabase" doc:name="receive lines and store in database"&gt; &lt;vm:inbound-endpoint exchange-pattern="one-way" path="in" doc:name="VM" /&gt; &lt;Choice&gt; . . Your JDBC Stuff . . &lt;Choice /&gt; &lt;/flow&gt; </code></pre> <p>Maintain your current <code>file-connector</code> configuration to enable streaming. With this solution the csv data can be processed without the need to load the entire file to memory first. HTH</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload