> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.itential.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server.

# Events

> Job and SLA event topics published by Itential Platform, including payload structures and subscription examples.

Itential Platform publishes events using an internal [event system](./event-system).

To subscribe to an event topic, provide a source and event handler in the format `source, topic, handler`:

```javascript
eventSystem.subscribe("@itential/app-workflow_engine", "jobStart", jobStartHandler);
```

## Job events

The table below lists event topics published to the Itential Platform environment.

| Event source                   | Event topic           | Description                                     | Payload                          |
| ------------------------------ | --------------------- | ----------------------------------------------- | -------------------------------- |
| @itential/app-workflow\_engine | jobStart              | Publishes when a job starts.                    | Started job                      |
| @itential/app-workflow\_engine | jobComplete           | Publishes when a job completes.                 | Completed job                    |
| @itential/app-workflow\_engine | jobError              | Publishes when a job encounters an error.       | Error job                        |
| @itential/app-workflow\_engine | jobFix                | Publishes when a job reverts.                   | Reverted job                     |
| @itential/app-workflow\_engine | jobPause              | Publishes when a job pauses.                    | Paused job                       |
| @itential/app-workflow\_engine | jobResume             | Publishes when a job resumes.                   | Resumed job                      |
| @itential/app-workflow\_engine | jobCancel             | Publishes when a job is canceled.               | Canceled job                     |
| @itential/app-workflow\_engine | jobSlaBreach          | Publishes when a job breaches its SLA.          | Job SLA                          |
| @itential/adapter-nso          | ncs-alarms            | Publishes when NSO encounters an alarm.         | NSO alarm object                 |
| @itential/adapter-nso          | ncs-events            | Publishes when NSO events occur.                | NSO events object                |
| @itential/adapter-nso          | device-notifications  | Publishes when NSO device notifications occur.  | NSO notifications object         |
| @itential/adapter-nso          | service-state-changes | Publishes when NSO service state changes occur. | NSO service state changes object |

## Event payload structure

All job event payloads contain a `job` property with the complete job document from the database at the time the system publishes the event. The job document's structure and content vary based on the workflow definition and the job's current state.

### Standard job events

Standard job events (`jobStart`, `jobComplete`, `jobError`, `jobFix`, `jobPause`, `jobResume`, `jobCancel`) follow this structure:

```javascript
{
  type: <number>,
  source: '@itential/app-workflow_engine',
  topic: '<event_topic>',
  instance: 'WorkFlowEngine',
  timestamp: <timestamp_in_milliseconds>,
  payload: {
    job: {
      // Complete job document from MongoDB
      _id: '<job_id>',
      name: '<job_name>',
      tasks: { /* task definitions */ },
      status: '<job_status>',
      // Additional job properties...
    }
  }
}
```

## Subscribe to job events

You can subscribe to job events using the global `eventSystem` object available in applications and adapters. This example subscribes to multiple job events:

```javascript
const util = require('util');

const inspect = msg => {
  console.log(util.inspect(msg, false, null, true));
}

// Subscribe to job lifecycle events
eventSystem.subscribe('@itential/app-workflow_engine', 'jobStart', inspect);
eventSystem.subscribe('@itential/app-workflow_engine', 'jobComplete', inspect);
eventSystem.subscribe('@itential/app-workflow_engine', 'jobError', inspect);
eventSystem.subscribe('@itential/app-workflow_engine', 'jobFix', inspect);
eventSystem.subscribe('@itential/app-workflow_engine', 'jobPause', inspect);
eventSystem.subscribe('@itential/app-workflow_engine', 'jobResume', inspect);
eventSystem.subscribe('@itential/app-workflow_engine', 'jobCancel', inspect);
eventSystem.subscribe('@itential/app-workflow_engine', 'jobSlaBreach', inspect);
```

## Job SLA events

Job SLA events are supported in Itential Platform 6, 2023.2, and 2023.1.

You can use the events defined above within the platform through **Operations Manager triggers** and the **EventListenerJob task** within a workflow. You can build automations in Operations Manager that trigger when a job breaches its service level agreement (SLA). For more information, see [Event triggers](../operations-manager/triggers#event-triggers).

### jobSlaBreach payload structure

The `jobSlaBreach` event includes additional properties beyond the standard job document:

* **job**: The complete job document from the database at the time of the SLA breach.
* **runTime**: The job's runtime in milliseconds.
* **slaDelta**: The amount in milliseconds that the job overran its SLA threshold. For example, if you set the SLA threshold to 2000 ms and the job runs for 3086 ms, the `slaDelta` is 1086 ms.

### Example jobSlaBreach event

```javascript
{
  type: 16,
  source: '@itential/app-workflow_engine',
  topic: 'jobSlaBreach',
  instance: 'WorkFlowEngine',
  timestamp: 1758819821241,
  payload: {
    job: {
      _id: '50329d1bc0594165b5b1825a',
      name: 'slaBreach',
      tasks: {
        '1132': {
          name: 'delay',
          canvasName: 'delay',
          summary: 'Delay a Job',
          description: 'Delay a Job for a duration by Job ID and number of seconds.',
          location: 'Application',
          locationType: null,
          app: 'WorkFlowEngine',
          type: 'operation',
          displayName: 'WorkFlowEngine',
          variables: {
            incoming: { time: null },
            outgoing: { time_in_milliseconds: '' },
            decorators: []
          },
          actor: 'Pronghorn',
          groups: [],
          nodeLocation: { x: 24, y: -84 },
          status: 'complete',
          previous: { incomplete: [], complete: [], error: [] },
          incomingRefs: [
            {
              type: 'static',
              pointer: '/variables/incoming/time',
              reference: { location: 'document', value: 2 }
            }
          ],
          outgoingRefs: [
            {
              type: 'taskOutgoing',
              status: 'success',
              pointer: '/variables/outgoing/time_in_milliseconds',
              taskVariableName: 'time_in_milliseconds'
            },
            {
              type: 'taskOutgoing',
              status: 'error',
              pointer: '/variables/error',
              taskVariableName: null
            }
          ],
          taskId: '1132',
          owner: 'Pronghorn',
          iterations: [ '440c69a5-e38b-495d-a0a2-00363f924fc1' ],
          transitions: { success: [ { task: 'workflow_end', type: 'standard' } ] },
          serverId: 'local_node1',
          start_time: '2025-09-25T17:03:38.957Z',
          end_time: 1758819820979,
          finish_state: 'success'
        },
        workflow_start: {
          name: 'workflow_start',
          groups: [],
          nodeLocation: { x: 0, y: -500 },
          x: 0,
          y: 0.5,
          status: 'complete',
          metrics: {
            start_time: 1758819818925,
            user: '667afeda7cd7b76286c0bfb5',
            finish_state: 'success'
          },
          taskId: 'workflow_start',
          owner: 'Pronghorn',
          iterations: [],
          transitions: { success: [ { task: '1132', type: 'standard' } ] }
        },
        workflow_end: {
          name: 'workflow_end',
          groups: [],
          nodeLocation: { x: 0, y: 500 },
          x: 1,
          y: 0.5,
          status: 'complete',
          previous: { incomplete: [], complete: [ '1132' ], error: [] },
          taskId: 'workflow_end',
          owner: 'Pronghorn',
          iterations: [],
          transitions: {},
          endTasks: { incomplete: [], complete: [], error: [] },
          metrics: { end_time: 1758819821011, run_time: 2086 }
        }
      },
      transitions: {
        '1132': { workflow_end: { state: 'success', type: 'standard' } },
        workflow_start: { '1132': { state: 'success', type: 'standard' } },
        workflow_end: {}
      },
      canvasVersion: 3,
      type: 'automation',
      font_size: 12,
      errorHandler: null,
      preAutomationTime: 0,
      sla: 1000,
      groups: [ 'default' ],
      last_updated: '2025-09-25T17:03:41.008Z',
      lastUpdatedVersion: '5.55.5',
      uuid: '82cbd255-86aa-4fc1-b403-6cc3a20e0986',
      created: '2025-09-25T17:03:10.090Z',
      created_by: '667afeda7cd7b76286c0bfb5',
      createdVersion: '5.55.5',
      encodingVersion: 1,
      last_updated_by: '667afeda7cd7b76286c0bfb5',
      description: '',
      status: 'complete',
      variables: {
        _id: { location: 'job_data', _id: '68d575ea51431df6af6c7e4e' },
        initiator: { location: 'job_data', _id: '68d575ea51431df6af6c7e4f' }
      },
      watchers: [ '667afeda7cd7b76286c0bfb5' ],
      ancestors: [ '50329d1bc0594165b5b1825a' ],
      mocked: false,
      decorators: [],
      metrics: {
        start_time: 1758819818925,
        user: '667afeda7cd7b76286c0bfb5',
        progress: 1,
        end_time: 1758819821011
      }
    },
    runTime: 2086,
    slaDelta: 1086
  }
}
```

In this example, the job had an SLA threshold of 1000 ms but took 2086 ms to complete, resulting in an SLA breach with a `slaDelta` of 1086 ms.

## Configure the EventListenerJob task

The following figure shows how to configure the EventListenerJob task to receive the `jobSlaBreach` event.

![](/_fern-img/2aad01e577edac3089ff96a4e044cab40fe80b8d41b35d11a6b70e1a618f68a5.webp)

For additional SLA information, see [Setting job metrics](/itential-platform/operations-manager/jobs-and-job-metrics#setting-up-savings-metrics).