Announcement Announcement Module
Collapse
No announcement yet.
Delete Flat File after reading Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Delete Flat File after reading

    Hi guys,

    I am new to Spring Batch. I have a simple setup that uses FlatFileItemReader to read in a file and then uses a writer to write it to a database. I would like to delete the file after it is read (or after the writer, doesn't matter). What is the best/simplest way to do this?

    Here is part of the code snippet for the reader:

    <beans:bean id="MultiResourceItemReader.MemberRegistration" class="org.springframework.batch.item.file.MultiRe sourceItemReader">
    <beansroperty name="resources" value="file:\DataExtractSampleFiles\*MEM_REG.txt "/>
    <beansroperty name="delegate" ref="ItemReader.MemberRegistration">
    </beansroperty>
    </beans:bean>

    <beans:bean id="ItemReader.MemberRegistration" class="org.springframework.batch.item.file.FlatFil eItemReader">
    <beansroperty name="lineMapper">
    <beans:bean class="org.springframework.batch.item.file.mapping .DefaultLineMapper">
    <beansroperty name="lineTokenizer">
    <beans:bean class="org.springframework.batch.item.file.transfo rm.DelimitedLineTokenizer">
    <beansroperty name="delimiter" value="|"/>
    <beansroperty name="names" value="memberId,loginName,email,registrationDate,l astAccessedDate,cobrandId,country,state,city,zipCo de,ipAddress,guid,extractDate,extractDateMilliseco nds"/>
    </beans:bean>
    </beansroperty>
    <beansroperty name="fieldSetMapper">
    <beans:bean class="za.com.MemRegFieldSetMapper" />
    </beansroperty>
    </beans:bean>
    </beansroperty>
    </beans:bean>

  • #2
    Not sure if you found the answer. But, this specific issues has been discussed in the past..

    You can implement step/job listener and implement file archival/deletion from there.

    Comment

    Working...
    X