JBoss Community

Configuring Quartz in External properties(EJBs are not injected)

created by Andriy Lytvynskyy in EJB3 Development - View the full discussion

Hi

 

I'm using EJB 3.0, and I'm using Quartz, I removed all the annotations for my MDB which implements Job interface because I want to configure Quartz (cron scheduling) out of my application:

I have quartz.properties which are in my classpath:

#===============================================================

# Configure Main Scheduler Properties

#===============================================================

org.quartz.scheduler.instanceName = QuartzScheduler
org.quartz.scheduler.instanceId = AUTO

#===============================================================

# Configure ThreadPool
#===============================================================

org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 5
org.quartz.threadPool.threadPriority = 5

#===============================================================

# Configure JobStore

#===============================================================

org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
org.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.JobInitializationPlugin
org.quartz.plugin.jobInitializer.fileName = dpp-quartz-job.xml
org.quartz.plugin.jobInitializer.overWriteExistingJobs = false
org.quartz.plugin.jobInitializer.failOnFileNotFound = true

 

I've got also dpp-quartz-job.xml which descibes my job is laced to 'conf' folder in JBoss:

<?xml version="1.0" encoding="UTF-8"?>

 

<quartz xmlns="http://www.opensymphony.com/quartz/JobSchedulingData"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
overwrite-existing-jobs="true">
    <job>
        <job-detail>
            <name>MyTask</name>
            <group>Svn Update Parse Group</group>
            <description></description>
            <job-class>
                com.avery.dpp.QuartzUtils
            </job-class>
            <job-data-map allows-transient-data="false">
                <entry>
                    <key></key>
                    <value></value>
                </entry>
            </job-data-map>
        </job-detail>
        <trigger>
            <cron>
                <name>JobTrigger</name>
                <group>trigger-group</group>
                <job-name>Svn Update Parse</job-name>
                <job-group>Svn Update Parse Group</job-group>
                 <!-- Fire every 2 seconds -->
                <!-- <cron-expression>0/2 * * * * ?</cron-expression -->

 

                <!-- Fire every November 11 at 11:11 AM -->
                <!-- cron-expression>0 11 11 11 11 ?</cron-expression -->

 

                <!-- Daily Every day at 18:15 PM -->
                <cron-expression> 0 17 18 * * ?</cron-expression>
            </cron>
        </trigger>
    </job>
</quartz>

Reply to this message by going to Community

Start a new discussion in EJB3 Development at Community