https://github.com/hmcts/job-scheduler
Job scheduler for hmcts
https://github.com/hmcts/job-scheduler
flyway postgresql quartz scheduler spring-boot
Last synced: 10 months ago
JSON representation
Job scheduler for hmcts
- Host: GitHub
- URL: https://github.com/hmcts/job-scheduler
- Owner: hmcts
- License: mit
- Created: 2017-11-29T11:41:40.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-09-01T11:36:54.000Z (almost 3 years ago)
- Last Synced: 2025-03-30T02:33:22.802Z (over 1 year ago)
- Topics: flyway, postgresql, quartz, scheduler, spring-boot
- Language: Java
- Homepage:
- Size: 294 KB
- Stars: 1
- Watchers: 10
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Job Scheduler
[](https://travis-ci.org/hmcts/job-scheduler)
[](https://www.codacy.com/app/HMCTS/job-scheduler)
[](https://www.codacy.com/app/HMCTS/job-scheduler)
The job scheduler micro service allows other services to schedule http actions in the future. For example, scheduler
can send a POST request to a specified url every Sunday at 2am.

## Getting started
### Prerequisites
- [JDK 8](https://java.com)
### External service dependencies
In order to validate service auth tokens, Job Scheduler sends http requests to S2S Service.
URL to S2S can be configured via the config file or using environment variables.
S2S Service is currently not open source.
### Running
Run the application by executing:
```bash
./gradlew bootRun
```
In order to run the application (with its database) in Docker, execute:
```bash
./bin/run-in-docker.sh
```
For more information:
```bash
./bin/run-in-docker.sh -h
```
Script includes bare minimum environment variables necessary to start database and api instances. Whenever any variable is changed or any other script regarding docker image/container build, the suggested way to ensure all is cleaned up properly is by this command:
```bash
docker-compose rm
```
It clears stopped containers correctly. Might consider removing clutter of images too, especially the ones fiddled with:
```bash
docker images
docker image rm
```
There is no need to remove postgres and java images.
## API documentation
Api documentation is provided with Swagger:
- json spec: [http://localhost:8484/v2/api-docs](http://localhost:8484/v2/api-docs)
- swagger UI: [http://localhost:8484/swagger-ui.html](http://localhost:8484/swagger-ui.html)
## Developing
### Unit tests
To run all unit tests execute the following command:
```bash
./gradlew test
```
### Code quality checks
We use [checkstyle](http://checkstyle.sourceforge.net/) and [PMD](https://pmd.github.io/).
To run all checks execute the following command:
```bash
./gradlew check
```
## Job management
The service manages its clients' jobs with [Quartz](http://www.quartz-scheduler.org/).
It uses a PostgreSQL database for persisting those jobs. Also, Quartz is configured
to run in cluster mode, i.e. the load will be distributed among multiple nodes, each
running different jobs.
## Data security
As of now, job information is stored in an unencrypted form. This means that clients
of this service must not include any sensitive information (tokens, passwords, personally
identifiable information, etc.) in their requests.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.