Skip to content

Latest commit

 

History

History
36 lines (22 loc) · 1.99 KB

components.md

File metadata and controls

36 lines (22 loc) · 1.99 KB

Components

Jobs

We use Spring Batch to create one-off and scheduled jobs.

For a one-off job:

  1. Create a new package under uk.gov.justice.digital.hmpps.hmppsinterventionsservice.jobs.oneoff
  2. For an example job, see #1286

For a scheduled job:

  1. Create a new package under uk.gov.justice.digital.hmpps.hmppsinterventionsservice.jobs.scheduled
  2. For an example job, see the NDMIS report job

For both:

  1. Provide an ApplicationRunner @Bean to make the job callable from command line, see #1348 or this example
  2. Create a CronJob or a Job in helm_deploy that will let it be executed on the environments, see this example

Running

For both kind of jobs, running locally:

SPRING_PROFILES_ACTIVE=local ./gradlew bootRun --args='--jobName=changelogMigrationJob'

To pass in arguments, use key=value pairs:

SPRING_PROFILES_ACTIVE=local ./gradlew bootRun --args='--jobName=transferReferralsJob fromContract=FROM toContract=TO'

To run on environments, assuming a CronJob, please see triggering scheduled jobs from the runbook.