Configuring the Report Scheduler

Introduction

To leverage this capability to the greatest extent, it is important to get familiar with configurability of this feature. This tutorial covers some of the most commonly used configuration parameters associated with the scheduling feature.

Objectives

This guide will enable you to:

Pre-Requisites

  • Access to the file system of and the ability to stop and start an operational installation of JasperReports Server
  • Access to a running outbound mail server.

Setting Up the Connection to your Outbound Email Server

In order for the scheduler to successfully send email notifications and distribute reports, it must be configured to connect to an outbound email server.

Step Action

1

Open the following configuration file in your preferred text editor: /WEB-INF/js.quartz.properties

2

Set the value for the mail.sender.host property to your outbound mail server.

Example: report.scheduler.mail.sender.host=outbound.yourdomain.com

3

Set the value for the mail.sender.protocol property to the protocol used by your outbound mail server.

Example: report.schedulers.mail.sender.protocol=smtp

4

Set the value for the mail.sender.port property to the port that your outbound mail server listens on.

Example: report.schedler.mail.sender.port=25

5

Set the mail.sender.username and mail.sender.password properties using valid login credentials to your outbound mail server.

Example: report.scheduler.mail.sender.username=myusername report.scheduler.mail.sender.password=mypassword

6

Restart JasperReports Server for the configurations to take effect.

Setting the Outbound Email Address for the Scheduler

When the scheduler sends out emails, these emails need to come from a specific email address as the sender. This should be a valid email that is monitored for email bounce backs, etc. so that appropriate action can be taken.

The following steps cover how to define the email address that should be used as the sender of emails coming from the scheduler jobs.

Step Action

1

Open the following configuration file in your preferred text editor: /WEB-INF/js.quartz.properties

2

Set the value for the mail.sender.from property to the email address you would like emails to come from.

Example: report.scheduler.mail.sender.from=yourname@yourdomain.com

3

Restart JasperReports Server for the configurations to take effect.

When a link to a report is sent out in an email from a scheduler job, this link must refer the user back to the appropriate place on the server to access the output. In order for this to occur, the scheduler must be aware of the URI for JasperReports Server.

Example: If the default login page for JasperReports Server is accessed by going to http://www.yourdomain.com/jasperserver-pro/login.html, the URI for the scheduler should be set to http://www.yourdomain.com/jasperserver-pro.

The following steps outline how to set the URI properly.

Step Action

1

Open the following configuration file in your preferred text editor: /WEB-INF/js.quartz.properties

2

Set the value for the web.deployment.uri property to the URI for your JasperReports Server installation.

Example: report.scheduler.web.deployment.uri=http://www.yourdomain.com/jasperserver-pro

3

Restart JasperReports Server for the configurations to take effect.

Defining the Number of Scheduler Threads per Server

In order to keep the scheduler jobs from using too many resources on a particular server, it is important to control the number of threads used to process scheduled jobs.

  • The thread count controls the maximum number of concurrent scheduler jobs that will run on a server at once.
  • Increasing this count increases the throughput of schedules that can be processed, but may adversely impact the resources available for end-users that are interacting directly with the application.

The following steps cover how to configure the number of threads per server that will process scheduled jobs.

Step Action

1

Open the following configuration file in your preferred text editor: /WEB-INF/js.quartz.base.properties

2

Set the value for the threadPool.threadCount property to the number of threads you want to process schedule jobs per server.

Example: org.quartz.threadPool.threadCount=3

3

Restart JasperReports Server for the configurations to take effect.

Defining the Job Misfire Threshold

The misfire threshold sets the amount of time that can pass before a missed or delayed scheduler job is skipped.

  • Increasing the misfire threshold will allow reports to run even if schedules are delayed due to server downtime or a backlog of jobs scheduled at the same time.
  • Decreasing this threshold is useful if you have jobs that are scheduled frequently.

Example: If a report is scheduled every hour, you may not want the 8am report to run if it is already 9am and the 9am report would give you the same information.

The following steps show how to set the misfire threshold.

Step Action

1

Open the following configuration file in your preferred text editor: /WEB-INF/js.quartz.base.properties

2

Set the value for the jobStore.misfireThreshold property to the number of milliseconds beyond the scheduled time that a delayed schedule job should be skipped.

Example: For 30 minutes, org.quartz.jobStore.misfireThreshold=1800000

3

Restart JasperReports Server for the configurations to take effect.

Disabling the Report Scheduler on a Server

Under certain circumstances, it may be necessary to disable the report schedules completely on a server.

Example: It may make sense to have dedicated servers for end users separate from those that execute scheduler jobs.

The following steps cover how to disable the report scheduler on a particular server.

Step Action

1

Open the following configuration file in your preferred text editor: /WEB-INF/applicationContext-report-scheduling.xml

2

Find the following lines:

<bean class="com.jaspersoft.jasperserver.api.engine.scheduling.quartz.QuartzSchedulerControl"
      depends-on="reportSchedulingService"
      id="quartzSchedulerControl"
      init-method="start">
    <property name="scheduler" ref="quartzScheduler" />
</bean>

3

Remove the init-method definition – init-method=”start”

4

Restart JasperReports Server for the configuration to take effect.

What's Next?

JasperReports Server leverages the quartz scheduler to execute scheduled report jobs. For more information on configuring or customizing quartz, please see:

Feedback