Skip to main content

Overview

The general flow of sending custom events to your connected server is as follows:
  1. You create your own event, or utilize our pre-configured events.
  2. In Atoti Limits, you trigger sending the event using the IServerEventIssuerService::sendServerEvent method.
  3. In your connected server, the auto-configured LimitsEventListenerRestService receives the event and broadcasts it to your connected server.
  4. Any Spring Event Listeners you have registered in your connected server for the event will invoke some action in the connected server.
See Baeldung’s article on Spring Events for more information on how they work.

Implementation

The following steps are used to send events from Atoti Limits to your connected server.

1. Define your event

You must define your event to be picked up within your connected server. Your event must implement ILimitApplicationEvent and be imported as a Spring Bean in your configuration. We recommend that implementations extend ADefaultLimitApplicationEvent. A sample event looks as follows:
The EventObject class’s source field is marked as transient. To correctly derserialize your custom event it is important that you override the getter for this field and mark it as ignored (via @JsonIgnore).

2. Send your event from Atoti Limits to your connected server

This is done by invoking the Spring service method IServerEventIssuerService::sendServerEvent at any point in the Atoti Limits code. For pre-configured events, Atoti Limits sends the events at the appropriate point in time. For custom events, you need to override the Atoti Limits code via Spring in order to send the events at the required time. For example, if you wanted to send your custom event when an evaluation request has completed, you can add custom evaluation logic to send the event as follows:

3. Listen for your event in your connected server

Add a Spring @EventListener method in your connected server to listen for the events sent by Atoti Limits. From here, you can invoke actions in your connected server that are dependent on events that have been triggered in Atoti Limits. For pre-configured events, you may implement your own IEventListenerService, which already has methods enabled to listen for the events Atoti Limits sends. To override existing logic Atoti Limits triggers, create an implementation that extends DefaultEventListenerService, for example:

Pre-configured events

The following events are bundled in Atoti Limits, which you may listen for in your connected server:
EventDescription
LimitsCreatedEventSent when limits are created.
LimitsUpdatedEventSent when limits are updated.
LimitsDeletedEventSent when limits are deleted.
LimitsKpiUpdatedEventSent when KPIs are refreshed.