Results 1 to 3 of 3

Thread: Job with variable step number

  1. #1
    Join Date
    Nov 2006
    Location
    London, UK
    Posts
    6

    Question 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:

    Code:
    	<batch:step id="updateFileLogStep">
    		<batch:tasklet reader="logFileReader" writer="logFileWriter" processor="logFileProcessor" commit-interval="1000">
    			
    			<!--  -->
    		</batch:tasklet>
    	</batch:step>
    	
    	<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>
    
    	<bean id="logEntryItemWriter" class="net.sourceforge.wurfl.wla.logic.batch.LogEntryItemWriter" scope="step">
    		<constructor-arg ref="logEntryRepository" />
    	</bean>
    
    	<bean id="logEntryItemProcessor" class="net.sourceforge.wurfl.wla.logic.batch.LogEntryItemProcessor" scope="step">
    		<constructor-arg ref="runningService" />
    	</bean>
    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 at 07:34 AM.
    Filippo De Luca

  2. #2
    Join Date
    Feb 2008
    Posts
    488

    Default

    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. #3
    Join Date
    Nov 2006
    Location
    London, UK
    Posts
    6

    Default

    Yeah,
    It is good solution for me. Thanks a lot.
    Filippo De Luca

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •