REST API and UI Console Manager for Quartz Scheduler. This is a Java Library & UI embeddable single page app, to control and monitor jobs scheduled with Quartz Scheduler
QUARTZ MANAGER
Quartz Manager UI
Quartz Manager API
HOW IT WORKS
Quartz Manager Starter API Lib
Quartz Manager Starter UI Lib
Quartz Manager Starter Security Lib
Quartz Manager Persistence Lib
EXAMPLES
LIMITATIONS
ROADMAP
REPOSITORY
HOW TO CONTRIBUTE
SUPPORT THE PROJECT
In the last decade, the Quartz Scheduler has become the most adopted opensource job scheduling library for Java applications.
Quartz Manager enriches it with a REST API layer and a handy UI console to easily control and monitor a Quartz Scheduler.
Quartz Manager is a Java library you can import in your Spring-Based Web Application to run scheduled jobs, start&stop them and get the job outcomes. You can do it through HTTP calls to the the Quartz Manager API or in a visual manner through the Quartz Manager UI dashboard.
The Quartz Manager UI is a dashboard in the form of a single-page-application provided by the Quartz Manager Java library itself. You can have it embedded in your project, as well as you get embedded the Swagger UI.
It leverages the websockets to receive in real-time the trigger updates and the outcomes of the job executions.
Quart-Manager exposes REST endpoints to interact with the Quartz Scheduler. This endpoints are invoked by Quartz Manager UI also.
The REST API are documented by an OpenAPI Specification interface.
Quartz Manager can either coexist with your existing instance of Quartz or it can import itself the Quartz dependency.
In the first case, Quartz Manager is compatible with Quartz v2.3.x . Quartz Manager creates and configures its own instance of Quartz Scheduler and it manages only the jobs and the triggers created through it. Your other jobs and triggers, running in the existing quartz instance, are out of the scope of Quartz Manager.
In the latter case, in which there isn’t an existing quartz instance, you can rely on Quartz Manager to speed up the setup of a Quartz instance, with a persistent storage also if you need it. Futhermore, if you start a bare project from scratch, just to run scheduled jobs, Quartz Manager comes with the option to enable a security layer to protect the API and the UI with an authentication model based on JWT.
FEATURES
Quartz-Manager-UI
updates in real time the progress bar and it displays the list of the latest logs produced by your quartz job.Requirements
Java 9+, Spring Framework 5+ (Spring Boot 2.x)
Quart Manager is a modular library:
In order to decrease the overall configuration time for the project, all modules of the library follow the approach of Spring Starters. Thus, it’s enough to import the dependency to get started.
Below the list of the quartz-manager modules you can import.
This is the only mandatory module of the library.
Add the dependency, make eligible for Quart Manager the job classes and set the props in your application.properties
file.
<dependency>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-starter-api</artifactId>
<version>4.0.9</version>
</dependency>
implementation group: 'it.fabioformosa.quartz-manager', name: 'quartz-manager-starter-api', version: '4.0.9'
The job classes, which can be eligible for triggers managed by Quartz Manager, must extend the super-class AbstractLoggingJob
.
In this way, Quartz Manager is able to collect and display the outcomes at the UI console.
public class SampleJob extends AbstractLoggingJob {
@Override
public LogRecord doIt(JobExecutionContext jobExecutionContext) {
... do stuff ...
return new LogRecord(LogType.INFO, "Hello from QuartManagerDemo!");
}
}
Property | Values | Mandatory | Default | Description |
---|---|---|---|---|
quartz-manager.jobClassPackages | string | Yes | java base package which contains your job classes | |
quartz-manager.oas.enabled | boolean | No | false | whether to create an OpenAPI instance to expose the OAS and the Swagger UI |
Set the app prop quartz-manager.oas.enabled=true
if you want to expose the OpenApi Specification of the Quartz Manager APIs.
Reach out the swagger-ui at the URL:
http://localhost:8080/swagger-ui.html
If your project has already an OpenAPI instance and you’ve set quartz-manager.oas.enabled=true
, then make sure to add an OpenApiGroup to group the API of your application. Quart Manager exposes its API in group called “Quartz Manager”. If you use OAS Annotations:
@Bean
public GroupedOpenApi simplySpringDemoGroupedOpenApi() {
return GroupedOpenApi.builder().group("myapp").packagesToScan("com.example.myapp").build();
}
Quartz Manager creates its own instance of a Quartz Scheduler.
By default, the managed quartz instance is instantiated with the following props:
org.quartz.scheduler.instanceName=quartz-manager-scheduler
org.quartz.threadPool.threadCount=1
You can customize the configuration of the Quartz managed by Quartz Manager creating a file managed-quartz.properties
in the classpath (src/main/resources
).
For further details about the quartz properties, click here.
Quarz Manager imports transitively the Quartz Scheduler library ver 2.3.2.
However, Quartz Manager can be imported even thought you’ve already imported the quartz scheduler lib. Indeed Quartz Manager coexists with the existing Quarz Scheduler Instance you’ve created in your project. In that case, Quartz Manager will manage the triggers created by it and it won’t interfere with the other quartz instances.
The prerequesite is that you’ve imported a quartz scheduler ver 2.3.x.
You can configure the Quartz instance managed by Quartz Manager through the file managed-quartz.properties
and your own Quartz instance through the file quartz.properties
.
If you’ve created a SchedulerFactoryBean
, tag it as @Primary
to avoid conflicts in-type, since Quartz Manager creates another bean of the same type.
@Primary
@Bean
public SchedulerFactoryBean schedulerFactoryBean( JobFactory jobFactory, Properties quartzProperties) {
SchedulerFactoryBean factory = new SchedulerFactoryBean();
...
return factory;
}
You can optionally import the following dependency to have the UI Dashboard to interact with the Quartz Manager API.
<dependency>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-starter-ui</artifactId>
<version>4.0.9</version>
</dependency>
implementation group: 'it.fabioformosa.quartz-manager', name: 'quartz-manager-starter-ui', version: '4.0.9'
if you run locally http://localhost:8080/quartz-manager-ui/index.html
Import this optional dependency, if you want to enable a security layer and allow the access to the REST API and UI only to authenticated users.
The authentication model of Quartz Manager is based on JWT.
If you’re going to import Quartz Manager in a project with an existing configuration of Spring Security, consider the following:
quartz-manager-security-lib
. Simply, Quartz Manager will be under the hat of your security setup. In all other cases (based on HTTP headers, query params, etc) Quartz Manager is not aware about your auth token and it will implement its own authentication model./quartz-manager
. So it doesn’t interfere with your existing security setup.application.properties
) can access to Quartz Manager.Future development: the Quart Manager Security OAuth2 client.
<dependency>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-starter-security</artifactId>
<version>4.0.9</version>
</dependency>
compile group: 'it.fabioformosa.quartz-manager', name: 'quartz-manager-starter-security', version: '4.0.9'
Property | Values | Mandatory | Default | Description |
---|---|---|---|---|
quartz-manager.security.jwt.secret | string | Secret to sign the JWT Token | ||
quartz-manager.security.jwt.expiration-in-sec | number | no | 28800 | |
quartz-manager.security.accounts.in-memory.enabled | boolean | no | true | |
quartz-manager.security.accounts.in-memory.users[0].username | string | yes (if enabled) | ||
quartz-manager.security.accounts.in-memory.users[0].password | string | yes | ||
quartz-manager.security.accounts.in-memory.users[0].roles[0] | string | yes | set the value ADMIN |
By default, Quartz Manager runs with a org.quartz.simpl.RAMJobStore
that stores your managed scheduler in memory. The RAMJobStore is the simplest store and also the most performant. However it comes with the drawback that all scheduling data are lost if your applications ends or crashes. In case of a restarting of your app, you can’t resume the scheduler from the point it stopped.
Import the Quartz Manager Persistence Module if you want to persist your scheduler data.
The pre-requesite is the availability of Postgresql database where Quartz Manager can store its information. You have to provide it a bare database and a postresql user granted for DDL and DML queries. About the DDL, consider that Quartz Manager Persistence will create all tables, it needs to work, at the bootstrap.
<dependency>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-starter-persistence</artifactId>
<version>4.0.9</version>
</dependency>
compile group: 'it.fabioformosa.quartz-manager', name: 'quartz-manager-starter-persistence', version: '4.0.9'
Property | Values | Mandatory | Default | Description |
---|---|---|---|---|
quartz-manager.persistence.quartz.datasource.url | string | yes | eg. jdbc:postgresql://localhost:5432/quartzmanager | |
quartz-manager.persistence.quartz.datasource.user | string | yes | ||
quartz-manager.persistence.quartz.datasource.password | string | yes |
You can find some examples of different scenarios of projects which import Quartz Manager at the repository quartz-manager-use-cases
Step by step, day by day
Quartz Manager has a work-in-progress roadmap to be full-fledged library to manage a Quartz Scheduler.
At this stage of the roadmap, these are the limitations:
Take a look a the Project Roadmap.
Don’t hesitate to give your feedback, your opinion is important to understand the priority.
Next steps in the roadmap are:
Checkout the master branch to get the sourcecode of the latest released versions.
Checkout the develop branch to take a look at the sourcecode of the incoming release.
For tech details, how-to run locally the project and how-to contribute, reach out this other README.md
Sometimes it’s a matter of a kind action. You can support Quartz Manager and its continuous improvement turning on a github star on this project ⭐