Announcement Announcement Module
No announcement yet.
Job with variable step number Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Job with variable step number

    Hi Guys,
    I'm working on we server analyzing tool. The aim is to analyze each request to display information about requester.

    The application define an Entity Project representing a web application to analyze.

    Each Project instance, formely a JPA Entity, can have multiple logFile with different format.

    The application must , at regular time interval, to read device access from log files, and create some LogEntryItem to persist on DB.

    I want to define a Job composed by several Steps. Each step handle single LogFile.

    This is the step definition:

    	<batch:step id="updateFileLogStep">
    		<batch:tasklet reader="logFileReader" writer="logFileWriter" processor="logFileProcessor" commit-interval="1000">
    			<!--  -->
    	<bean id="logFileReader" class="org.springframework.batch.item.file.FlatFileItemReader" scope="step">
    		<property name="resource" value="#{stepExecutionContext[logFile.url]}" />
    		<property name="lineMapper" value="#{stepExecutionContext[logFileFormat.lineMapper]}" />
    	<bean id="logEntryItemWriter" class="net.sourceforge.wurfl.wla.logic.batch.LogEntryItemWriter" scope="step">
    		<constructor-arg ref="logEntryRepository" />
    	<bean id="logEntryItemProcessor" class="net.sourceforge.wurfl.wla.logic.batch.LogEntryItemProcessor" scope="step">
    		<constructor-arg ref="runningService" />
    The job must be called (by quartz i hope) for each running project. But each project has different number of handlig logFile, so the job can have different number of step.

    Ho ca I handle this situation? I must create subclass of SimpleJob?

    Thank a lot for your time, and excese me for my poor english.
    Last edited by filosganga; Mar 6th, 2009, 07:34 AM.

  • #2
    It might be easier to wrap the JobLauncher. Your launcher could the file system to see what files were available and then launch a the job for each file (giving the filename as a JobParameter).


    • #3
      It is good solution for me. Thanks a lot.