title: Using batch mode in Quartz
body: <p>With the intent to improve performance of quartz, I intend to use batching in quartz as suggested in <a href="http://www.ebaytechblog.com/2016/01/14/performance-tuning-on-quartz-scheduler/" rel="noreferrer">Performance Tuning on Quartz Scheduler</a></p>
  
  <p>We create our quartz scheduler in integration with spring as below.</p>
  
  <pre><code>&lt;bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"&gt;
          &lt;!-- Quartz requires a separate 'quartz.properties' file --&gt;
          &lt;property name="configLocation" value="classpath:/quartz.properties"/&gt;
  
          &lt;!-- Naturally, Quartz with the DB requires references
                to the data source and transaction manager beans --&gt;
          &lt;property name="dataSource" ref="quartzDataSource"/&gt;
          &lt;!--&lt;property name="transactionManager" ref="transactionManager"/&gt;--&gt;
  
          &lt;!-- reference to our 'autowiring job factory bean', defined above: --&gt;
          &lt;property name="jobFactory" ref="quartzJobFactory"/&gt;
  
          &lt;!-- Boolean controlling whether you want to override
                the job definitions in the DB on the app start up.
                We'll talk about it more in the next section. --&gt;
          &lt;property name="overwriteExistingJobs" value="true"/&gt;
  
          &lt;!-- I will not explain the next three properties, just use it as shown: --&gt;
          &lt;property name="autoStartup" value="${isQuartzEnabled}" /&gt;
          &lt;property name="schedulerName" value="quartzScheduler"/&gt;
          &lt;property name="applicationContextSchedulerContextKey" value="applicationContext"/&gt;
  
          &lt;!-- Controls whether to wait for jobs completion on app shutdown, we use 'true' --&gt;
          &lt;property name="waitForJobsToCompleteOnShutdown"
                    value="true"/&gt;
  
          &lt;!-- Tell the Quartz scheduler about the triggers.
                We have implemented the 'quartzTriggers' bean in the 'Jobs and triggers' section.
                No need to pass job definitions, since triggers created via Spring know their jobs.
                Later we'll see a case when we'll have to disable this and pass the jobs explicitly.--&gt;
          &lt;property name="triggers" ref="quartzTriggers"/&gt;
  
      &lt;/bean&gt;
  </code></pre>
  
  <p>How do I specify <strong>maxBatchSize</strong> &amp; <strong>batchTimeWindow</strong> of <a href="http://www.quartz-scheduler.org/api/2.1.7/org/quartz/impl/DirectSchedulerFactory.html#createScheduler(java.lang.String,%20java.lang.String,%20org.quartz.spi.ThreadPool,%20org.quartz.spi.ThreadExecutor,%20org.quartz.spi.JobStore,%20java.util.Map,%20java.lang.String,%20int,%20long,%20long,%20boolean,%20java.lang.String,%20int,%20long)" rel="noreferrer">createScheduler</a> in DirectSchedulerFactory ?</p>