Skip to content

jobrunr/storyline-demo

Repository files navigation

JobRunr Finance Storyline Demo

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).

  1. Create 2 basic jobs: (a) creation of the credit card, (b) Schedule a future job in a week: a reminder email to confirm receival.
  2. Recurring Jobs: reports of expenses need to be generated each month. Simulate PDF generation using Thread.sleep(). Cron 0 0 1 * * = "at 00:00 on day-of-month 1".
  3. Batches. We after successful generation of expense reports, generate/send a summary report (another job).
  4. Sometimes PDF generation fails. Showcase automatic retries & what happens when a batch job throws a RuntimeException.
  5. Add job labels per credit card type to more easily filter on the dashboard. Showcase filtering on name.
  6. Show the Pro Dashboard to inspect which credit cards are created, which jobs failed, various filters, ...
  7. High-prio jobs: payment should have priority over monthly report generation . Create high-prio,low-prio queues. Trigger 1000 expenses and showcase the high-prios still get done.
  8. Queues: Well-paying ENTERPRISE customers should have priority over PRO customers. Create a customer: prefix and add CustomerType.name() as the label suffix. Switch to weighted round-robin to showcase the difference.
  9. International payments should be processed on another server using server tags. (To start the second server, see the Gradle command below.)
  10. International payments should also be exported to an external system that has to be rate-limited to avoid DDoSing their system.
  11. Showcase observability/metrics possibilities: Micrometer metrics are exposed to the Prometheus Docker container by adding two more properties. Prometheus runs at http://localhost:9090.
  12. 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 8089 and supports GET to /verify returning the string looks good to me!

The following schematic describes the project structure, its actions (registering a new credit card), and its JobRunr jobs running in the background:

Adding JobRunr credentials

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.

Starting the application

  1. Start the database container: docker compose up
  2. Start the Spring Boot container: run StorylineDemoApplication or use Gradle: ./gradlew :demo-solution:bootRun. public class GovernmentApp {
  3. To showcase distributed tracing, also start the government app by running GovernmentApp or using Gradle: ./gradlew :governmentApp:bootRun.
  4. Navigate to http://localhost:8080/.

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'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published