In this demo, we gradually explore the capabilities of JobRunr Pro by following the steps below.
Find and complete all the // TODO Step x comments in project demo-start!
You can easily locate these by searching for the comment in your favourite IDE (e.g. ⌘+SHIFT+F in IntelliJ).
- Create 2 basic jobs: (a) creation of the credit card, (b) Schedule a future job in a week: a reminder email to confirm receival.
- Recurring Jobs: reports of expenses need to be generated each month. Simulate PDF generation using
Thread.sleep(). Cron0 0 1 * *= "at 00:00 on day-of-month 1". - Batches. We after successful generation of expense reports, generate/send a summary report (another job).
- Sometimes PDF generation fails. Showcase automatic retries & what happens when a batch job throws a
RuntimeException. - Add job labels per credit card type to more easily filter on the dashboard. Showcase filtering on name.
- Show the Pro Dashboard to inspect which credit cards are created, which jobs failed, various filters, ...
- High-prio jobs: payment should have priority over monthly report generation . Create
high-prio,low-prioqueues. Trigger 1000 expenses and showcase the high-prios still get done. - Queues: Well-paying
ENTERPRISEcustomers should have priority overPROcustomers. Create acustomer:prefix and addCustomerType.name()as the label suffix. Switch to weighted round-robin to showcase the difference. - International payments should be processed on another server using server tags. (To start the second server, see the Gradle command below.)
- International payments should also be exported to an external system that has to be rate-limited to avoid DDoSing their system.
- Showcase observability/metrics possibilities: Micrometer metrics are exposed to the Prometheus Docker container by adding two more properties. Prometheus runs at http://localhost:9090.
- Showcase observability/tracing possibilities: Traces are being exported to the Jaeger Docker container by adding two Spring Boot & two JobRunr Pro properties. Jaeger runs at http://localhost:16686.
The project contains three subprojects:
demo-solution; the implemented version;demo-start; the version without any JobRunr specifics where the above steps have yet to be implemented.government-app; a mostly empty app representing the government where expenses need to be exported to- Runs at port
8089and supports GET to/verifyreturning the stringlooks good to me!
- Runs at port
The following schematic describes the project structure, its actions (registering a new credit card), and its JobRunr jobs running in the background:
You will need to enter your JobRunr credentials in two ways:
Private Maven repository credentials
Create gradle.properties in the root folder of this project with the following contents:
PRIVATE_MAVEN_REPO_URL=https://repo.jobrunr.io
org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 --add-opens=java.base/java.io=ALL-UNNAMED
org.gradle.caching=true
mavenUser=yourUserName
mavenPass=yourPassword
JobRunr Pro license key
Create jobrunr-pro.license in src/main/resources of each of the subprojects and paste in your license key.
- Start the database container:
docker compose up - Start the Spring Boot container: run
StorylineDemoApplicationor use Gradle:./gradlew :demo-solution:bootRun. public class GovernmentApp { - To showcase distributed tracing, also start the government app by running
GovernmentAppor using Gradle:./gradlew :governmentApp:bootRun. - Navigate to http://localhost:8080/.
- The JobRunr dashboard runs at http://localhost:8000/ (and on the same port in the solution to showcase the embedded dashboard)
- The government app runs at http://localhost:8089/.
- Prometheus runs at http://localhost:9090/.
- Jaeger runs at http://localhost:16686/.
To run the second background server, override these properties:
server.port (set to 8081), jobrunr.dashboard.enabled (set to false), and set the correct server tags with jobrunr.background-job-server.tags (set to international):
./gradlew :demo-start:bootRun --args='--server.port=8081 --jobrunr.dashboard.enabled=false --jobrunr.background-job-server.tags=international'
./gradlew :demo-solution:bootRun --args='--server.port=8081 --jobrunr.dashboard.enabled=false --jobrunr.background-job-server.tags=international'
