Skip to content

Jobs

See Jobs for what a job is. Use eventStore.jobs to inspect and control Chronicle jobs in a namespace.

eventStore.jobs exposes:

  • stop(jobId)
  • resume(jobId)
  • delete(jobId)
  • getJob(jobId)
  • getJobs()
  • getJobSteps(jobId)

For jobId, you can pass:

  • JobId
  • Guid
  • string (guid text)
import { ChronicleClient, ChronicleOptions } from '@cratis/chronicle';
const client = new ChronicleClient(ChronicleOptions.development());
const eventStore = await client.getEventStore('MyStore');
const jobId = '94ba2c17-0977-478e-a278-70f6757aac2d';
await eventStore.jobs.stop(jobId);
await eventStore.jobs.resume(jobId);
client.dispose();

getJob(jobId) returns undefined when the job is not found.

const job = await eventStore.jobs.getJob('94ba2c17-0977-478e-a278-70f6757aac2d');
if (!job) {
console.log('Job not found');
}