Search code examples
javajasper-reportsquartz-scheduler

Schedule jasper report using quartz scheduler


I am using the quartz for creating the schedule and run the job. However, I need to generate and send the jasper report in one of the job. I know that jasper server can be used to schedule the report but I have scheduled created in my java application. How can one create the report using java application.

I read through the link - Jasper Report scheduler

In short how do one ask jasper server to create the report and let quartz job send an email to given user.

public class MyJob implements Job {

@Override
public void execute(JobExecutionContext context) throws JobExecutionException {

    System.out.println("Context : " + context.toString());

  //Can we create the jasper report here and then send using email, I have jasper server but I wanted to use the separate job to process the report and send. 

 }

Solution

  • You can access you JasperServer via REST API and do the rest of job in the Quarz scheduler.
    1) Start Quartz job.
    2) Authenticate on Jasper Server (here is documentation)
    3) Call the report via REST API (documentation)
    4) Get the result and do anything you want (e.g. sent to email).
    5) End Quartz job.