1

I have a very large csv file, that makes my Job run into 30 min. My data comes from purecloud. I need to write it in three diferents periods depending on the value of the time field (2021-03-10T11:44:01.781Z) : 00-10, 10-14 , 14-23 hours.

Here is one row in the file:

b1df888d-bebe-4a0b-a44a-0b891c660586;tAlert;205;2021-03-10T11:44:01.781Z

I run with a tasklet chunk like this :

 <step id="step1">
        <tasklet>
            <chunk reader="itemReader" writer="testCompositeWriter"
                   commit-interval="1">
            </chunk>
        </tasklet>
    </step>

and in the reader I am doing something like this:

fecha = obtenerFechaFin(i).split("T");           //2021-03-07T07:19:18.051Z string DATE
    horas = fecha[1];                            //07:19:18.051Z   string HOURS
    horaIntervalo = horas.split(":");
    hora = horaIntervalo[0];                     //07 string
    horaInt = Integer.parseInt(hora);           //07 int  HOUR

    if (horaInt >= 00 && horaInt < 10){
        
        lisConversationOutBackup.addAll(generarSalida(conversationsOut.getConversations()));

    }
    if (horaInt >= 10 && horaInt < 14){

    }
    if (horaInt >= 14 && horaInt < 23){

    }

can "commit-interval" or any other sentence make this?

Ibai
  • 11
  • 2
  • Do you mean you want items to be written in 3 different files depending on the value of the time field (`2021-03-10T11:44:01.781Z`)? – Mahmoud Ben Hassine Mar 12 '21 at 09:21
  • Yes, depending on the value of the hour. – Ibai Mar 12 '21 at 09:23
  • ok in this case, see the duplicate question. I provided an answer with complete example here: https://stackoverflow.com/a/53388876/5019386. You can adapt it to classify items based on the hour of the time field. – Mahmoud Ben Hassine Mar 12 '21 at 09:25

0 Answers0