Results 1 to 3 of 3

Thread: Best practice for a pooling job?

  1. #1
    Join Date
    Mar 2007
    Location
    near Dortmund, Germany
    Posts
    4

    Default Best practice for a pooling job?

    We have a job that is pooling. It has to look into a directory and pick up files from there if there are some. A classic "hot folder".

    At the moment we have a job with just one step. The reader returns null if there are no (more) files in the directory. The job is started with a delay of 30 seconds.

    Code:
    <task:scheduled ref="pdfImportStarter" method="startJob" fixed-delay="30000" />
    For us that seams to be the natural way to do it. The problem: It fills the batch database tables with new jobs very fast. You really have to search the other jobs. We filter this, but it is not very nice.

    What is the best practice for that use case? Implementing a blocking reader that may be never returns null? Or defining a precondition that we check in the pdfImportStarter? This seams to duplicate code.

  2. #2
    Join Date
    Apr 2008
    Location
    Philadelphia, US
    Posts
    198

    Arrow

    @jgottschling,

    Spring Integration can help you here. You can create a file poller which will poll the directory ( every so often ) and will pass the files to create a "JobLaunchRequest" that will have your Job launched.

    Something similar is available in Spring Batch Admin Samples ( from git.springsource.org ): http://bit.ly/dlwdgg

    /Anatoly
    Humans are stateful and mutable beings that have no problems processing many things concurrently and share state with others + they are usually "coupled"

  3. #3
    Join Date
    Mar 2007
    Location
    near Dortmund, Germany
    Posts
    4

    Default

    Thank you, Anatoly. I'll have a look at this solution.

    BR, Jörg

Posting Permissions

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