For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Open sourceSupportFAQsDocs Home
DocumentationAPI referenceRelease notes
DocumentationAPI referenceRelease notes
  • Platform On-Prem
    • Overview
    • Navigate
    • Search resources
      • Adapter API routes
      • Adapter degraded status
      • Broker principal config setting
      • Enumerations in applications
      • Event system
      • Events
      • Log class
      • Naming conventions
      • Public and trusted methods
      • Run as another user
      • Service brokers
      • Service config property encryption
      • Serving UI directories
      • Table control
  • Apps
    • FlowAI
    • Itential Automation Gateway
  • Resources
    • Itential Academy
    • Version lifecycle
    • Itential MCP
    • Accessibility conformance
    • Get support
    • FAQs
LogoLogo
Open sourceSupportFAQsDocs Home
On this page
  • Event definition
  • Namespace
  • Registration
  • Subscription
  • Unsubscribe from an event
  • Publish an event
Platform On-PremDeveloper guide

Event system

Was this page helpful?
Previous

Events

Next
Built with

The event system is a global service object named eventSystem that is available to application developers in the Itential Platform environment. The eventSystem allows a service to publish information to the Itential Platform environment that other services can react to.

The event system has three main methods:

1eventSystem.publish(topic, payload);
2
3eventSystem.subscribe(source, topic, handler);
4
5eventSystem.unsubscribe(source, topic, handler);

Event definition

To define an event that you want your service to publish, add a topics section to the pronghorn.json of your application. For example:

1"topics" : {
2 "launch": {
3 "type": "object",
4 "required": ["rocket"],
5 "properties": {
6 "rocket": {}
7 }
8 },
9 "bananas": {}
10}

The example above defines two topics that can be emitted as events: launch and bananas. The launch object contains a JSON schema that defines what its event payload should look like. The rocket property is required for the event’s payload — if it is not present, the event will not be processed. If an event does not match the defined schema, it is rejected.

The bananas event has no requirement for its payload structure. You can publish as many events as you like:

1"topics" : {
2 "eventName1": {
3 -JSON Schema-
4 },
5 "eventName2": {
6 -JSON Schema-
7 },
8 "eventNameN": {
9 -JSON Schema-
10 }
11}

Namespace

Events are automatically namespaced using the model name of the application (for example, @itential/app-workflow_engine). This allows developers to have events with the same name across different applications — for example, the event name rocket could exist in both @itential/app-workflow_engine and @itential/app-configuration_manager.

Registration

When an application connects to Itential Platform, it automatically sends all of its defined event topics. Itential Platform adds the event topics to the global list it maintains and then broadcasts the updated global list to all other applications, allowing them to subscribe to the new events.

There is currently no verification of event payload within Itential Platform. This is handled by the eventSystem in the application when it receives a subscribed event.

Subscription

To handle a particular event, call the eventSystem.subscribe method. After subscribing, the event system calls the handler function when it receives the event and verifies the payload matches the schema.

$eventSystem.subscribe(source, topic, handler)
AttributeTypeDescription
sourcestringThe application publishing the event. For example: @itential/app-workflow_engine
topicstringThe name of the event topic you care about. For example: launch
handlerfunctionA handler function that processes the payload data of the event.

Example

$eventSystem.subscribe("@itential/app-workflow_engine", "launch", launchHandler);

Unsubscribe from an event

To stop listening for an event, call the eventSystem.unsubscribe method. This causes the event system to stop calling the handler function for that event.

$eventSystem.unsubscribe(source, topic, handler)
AttributeTypeDescription
sourcestringThe application publishing the event. For example: @itential/app-workflow_engine
topicstringThe name of the event topic you no longer care about. For example: launch
handlerfunctionA handler function that previously processed the payload of the event.

Example

$eventSystem.unsubscribe("@itential/app-workflow_engine", "launch", launchHandler);

Publish an event

To send an event, call the eventSystem.publish method. This sends the event to Itential Platform for broadcast to all other applications in the environment. No source is required when publishing — the namespace is automatically added by the event system to ensure proper scope.

$eventSystem.publish(topic, payload)
AttributeTypeDescription
topicstringThe name of the event you are sending. For example: launch
payloadobjectThe data related to your event. The payload must match the JSON schema defined in pronghorn.json for this event. If it does not match, the event will not be processed by subscribers.

Example

$// Notice required rocket field
$const launchPayload = {
> "rocket": "Saturn V",
> "destination": "Luna"
>};
$
$eventSystem.publish("launch", launchPayload);