Announcement Announcement Module
Collapse
No announcement yet.
Is it possible to use existing Quartz scheduler? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is it possible to use existing Quartz scheduler?

    hello all:

    we are testing spring-batch and we note that it uses a internal quartz engine for job squeduling.

    now we have a Quartz Scheduler (v5.0) running on the same spring context, but we really don't know if is it possible to force spring-batch to use the existing Quartz engine, do you?

    thanks all!

  • #2
    ups,
    i mean Quartz 1.6.0
    and spring-batch 1.1.0

    Comment


    • #3
      Spring Batch isn't using Quartz internally at all, it is completely agnostic of the scheduling environment. There's a sample job that does show how quartz could be integrated, but it's not required. You should be able to use your quartz instance in the same way.

      Comment


      • #4
        but, according to saple, I use the same injecting method for the triggers, but it fails on references injection to the quartz jobDetail:

        <bean id="schedulerFactoryBean" class="org.springframework.scheduling.quartz.Sched ulerFactoryBean">
        <property name="dataSource" ref="coreBatchDataSource"/>
        <property name="autoStartup" value="true"/>
        <property name="applicationContextSchedulerContextKey" value="applicationContext"/>
        <property name="triggers">
        <bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronT riggerBean">
        <property name="jobDetail" ref="jobDetail" />
        <property name="cronExpression" value="0/6 * * * * ?" />
        </bean>
        </property>
        </bean>

        <bean id="jobDetail" class="org.springframework.scheduling.quartz.JobDe tailBean">
        <property name="jobClass" value="com.ilc.core.batch.app.JobLauncherDetails" />
        <property name="group" value="quartz-batch" />
        <property name="jobDataAsMap">
        <map>
        <entry key="jobName" value="batchUpdateJob"/>
        <entry key="jobLocator" value-ref="jobRegistry"/>
        <entry key="jobLauncher" value-ref="jobLauncher"/>
        </map>
        </property>
        </bean>

        by launching I get:
        Couldn't store job: Unable to serialize JobDataMap for insertion into database because the value of property 'jobLauncher' is not serializable:

        the original sample is:
        <bean class="org.springframework.scheduling.quartz.Sched ulerFactoryBean">
        <property name="triggers">
        <bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronT riggerBean">
        <property name="jobDetail" ref="jobDetail" />
        <property name="cronExpression" value="0/6 * * * * ?" />
        </bean>
        </property>
        </bean>

        would it be that spring usage of quartz differs from default one?
        i think that spring sample usage stores the scheduling in memory, so you have no problems about serialization, etc. but our quartz implementation uses db persistence for schedules, so it fails on injecting to the jobs beans instead of primitives.

        what do you think about it? the real problem is the reference injection, im trying to inject references directly to the JobLauncherDetails (the one witch extends QuartzJobBean)

        thanks all!

        Comment

        Working...
        X