Create an attribute computing heartbeat

In this page, you will learn how to create a heartbeat that can be monitored to determine if the deployment is correctly computing attributes within an acceptable time frame.

The heartbeat is a file that is periodically written to the disk. An external system would then regularly look at the timestamp of this file and take appropriate measures if it finds that the file has not been updated for a long time. Appropriate measures might include:

  • Stopping and restarting the node if you have a standalone deployment.
  • Killing the active node and start the passive node if you have a primary/replica cluster.

To achieve this, select a computed attribute in your application, create an event based on this attribute and update the heartbeat file whenever the event is fired

Select an attribute

To monitor attribute computing, first select a computed attribute in your application.

Ideally, this attribute should be at the end of a dependency chain (that is, no other attribute should have this attribute as input) and it must have a small rhythm so that it is often computed (an attribute with a rhythm between 1 and 5 minutes is a good candidate).

Create an event

To monitor this attribute computation, you create an event triggered when this attribute is computed.

  • On the main menu, click the cog icon > Data Integration. On the left menu, click  Events,  then click the New Event button.
  • Enter computingHeartbeat in the Name text field.
  • Select the entity of the attribute you chose.
  • Select the attribute you chose.
  • Click Save.

In this example, we use the attribute inProcessCount of the Process entity.

Update the heartbeat file

Finally, create or update the heartbeat file when the event fires.

  1. Go to Data Integration > Routes and click the New Routing Context button
  2. Copy and paste the following content

    <routes xmlns="" xmlns:u="">
            <from uri="tnd-event:computingHeartbeat"/>
                    def acceptableLimit = new org.joda.time.DateTime().minusMinutes(15)
                    def newestComputingDate
                    for (timedValue in request.body.addedValues) {
                        if (timedValue.validTimeBegin.isAfter(acceptableLimit) && (newestComputingDate == null || newestComputingDate.isBefore(timedValue.validTimeBegin))) {
                            newestComputingDate = timedValue.validTimeBegin
                <groovy>request.body != null</groovy>
                <convertBodyTo type="java.lang.String"/>
                <to uri="file://c:/dev?fileName=computing.heartbeat"/>
  3. Change the location where the heartbeat file is written on line 20 (in this example, the file is written in the C:\dev directory).
  4. Click Save.
  5. Start the route.

Now wait for a little moment ( you have to wait for a tick of the attribute rhythm) and check that the heartbeat file has been correctly created and is regularly updated.

Related Links