Announcement Announcement Module
Collapse
No announcement yet.
Multiple I/O files Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple I/O files

    Hi,

    I use a simpleStep, with a reader and writer. The writer generate 2 output files (File1 and File2) using 2 delegates : one for each file. Each delegate is open in the "write" method.

    In this case the writer is writing twice in the same file File1. And File2 remains blank.

    My job.xml contains this :

    Code:
     <beans:bean id="myItemWriter" class="MyWriterr">
        <beans:property name="delegateFile1" ref="flatFileItemWriterFile1" />
        <beans:property name="delegateFile2" ref="flatFileItemWriterFile2 />
      </beans:bean>
    
      <beans:bean id="simpleStep" parent="simpleStep">
        <beans:property name="itemReader" ref="myItemReader"/>
        <beans:property name="itemWriter" ref="myItemWriter"/>
      </beans:bean>

    Code:
    public void write( List<? extends readElements> items )
            throws Exception
        {
    delegateFile1.open(...);
    delegateFile2.open(...);
    delegateFile1.write(...);
    delegateFile2.write(...);
        }
    How can I do to write in the 2 files?

    Thanks in advance.
Working...
X