Results 1 to 2 of 2

Thread: Complete example to poll for job files

  1. #1
    Join Date
    Dec 2010
    Posts
    3

    Default Complete example to poll for job files

    Hi I am new to Spring Batch. I have a working Spring Batch Admin deployment (spring-batch-admin-sample-1.0.0.M3) on Glassfish utilizing Spring Security, H2 database. I would like to define a directory that is polled for job files while the application is running and adds new jobs to the admin web interface (JobRegistry) but I can not find a complete example showing this feature. I will run these jobs later in other code.

    I figure this should not be too complex, prob just a matter of configuring my application-context.xml.

    Thanks in Advance!

  2. #2
    Join Date
    Dec 2010
    Posts
    3

    Default try #2

    looks like there is a build in job file polling feature. I tried adding C:\glassfishv3\glassfish\domains\domain1\applicati ons\spring-batch-admin-sample-1.0.0.M3\WEB-INF\classes\META-INF\spring\batch\override\jobFilePolling.xml
    (shown below) but this did not work as jobs are not picked up.


    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:file="http://www.springframework.org/schema/integration/file"
    xmlns:integration="http://www.springframework.org/schema/integration"
    xmlns="http://www.springframework.org/schema/p"
    xmlns:jdbc="http://www.springframework.org/schema/jdbc"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-3.0.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schem...spring-aop.xsd
    http://www.springframework.org/schema/batch http://www.springframework.org/schem...-batch-2.1.xsd
    http://www.springframework.org/schema/integration http://www.springframework.org/schem...ration-1.0.xsd
    http://www.springframework.org/schema/integration/file http://www.springframework.org/schem...n-file-1.0.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schem...ontext-3.0.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

    <!-- override the default dir - poll dir for xml job files
    the directory attribute is relative to the dir: C:\glassfishv3\glassfish\domains\domain1\applicati ons\spring-batch-admin-sample-1.0.0.M3
    -->
    <file:inbound-channel-adapter directory="jobFiles"
    channel="job-configuration-files"
    filename-pattern=".*\.xml">
    <integrationoller max-messages-per-poll="1">
    <integration:cron-trigger expression="5/1 * * * * *" />
    </integrationoller>
    </file:inbound-channel-adapter>
    </beans>

Posting Permissions

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