How to create alarms

This page describes how to generate alarms usable in Decision Insight's dashboards. The alarms are created or updated when the failure status of a Payment changes.

Create a dedicated space

Create a dedicated space for alarms: "alarm" linked to your application.

Create a dedicated classifier

Create classifier "AlarmStatus" in space "alarm". Define 3 instances: "RESOLUTION PENDING", "ACKNOWLEDGED", "CLOSED".

Create your alarm entity

  1. Go to the "Model Editor" panel, and create a new Entity named "FailedPaymentAlarm"

  2. Add a new observed attribute "status", of type Classifier of "AlarmStatus" :

     
     
  3. Add a new observed relation "payment" on Payment, and uncheck "multiple tail":

     
     
  4. Add a key "key", using previous relation "payment" as key attribute:
  5. Save your entity

Alarm mapping

Go to "Data integration" panel and add a mapping with

  • create parameters
    • resolution with type Instant
    • paymentId with type Instance
  • click Add Instance Operation and select FailedPaymentAlarm as entity
    • DEFAULT TIMES
      • for Resolution and Operations Begin, select resolution parameter
    • RESOLUTION
      • select "Create an instance of FailedPaymentAlarm if not found at resolution time or after"
      • choose resolved by "Instance identifier" for Payment resolution
      • for resolution value, select paymentId parameter

 
It is possible to set the alarm status initial value by adding an operation to the mapping. 

Event configuration

Go to the "Events" panel and choose the space "Alarm" in which you will create an event configuration with the following settings:

  • Name : failedPayment
  • For entity : Payment
  • when (Event target type) : Attribute
  • attribute : failureStatus

With this configuration, updates to failureStatus of Payment will be broadcast to routes that listen to tnd-event:failedPayment, and are registered on the same space.

Alarm creation

Go to the "Routes" tab, choose the Alarm space, and add a "New routing Context" named "generateAlarm".  

(info) "<from uri="tnd-event:failedPayment"/>" is based on the name of the event configuration from the previous section.

In this example we use the simplest data structures available in <u:extract-vtAxisTransitions> and when accessing information in the IndicatorUpdateEvent (the body of our message).

failedPaymentManagement
<routes xmlns="http://camel.apache.org/schema/spring" xmlns:u="http://www.systar.com/aluminium/camel-util">
    <route>
        <!-- This route receives a new message each time an IndicatorUpdateEvent is generated -->
        <from uri="tnd-event:failedPayment"/>
        <log message="Failed Payment"/>
        <log message="${body}"/>
        <!-- We store the instanceId of the payment in a header to be used later on -->
        <setHeader headerName="paymentId">
            <simple>body.instanceId</simple>
        </setHeader>
        <!-- We extract the changes made to failureStatus of Payment -->
        <setBody>
            <u:extract-vtAxisTransitions ignoreSuccessiveIdentical="true"/>
        </setBody>
        <split>
            <simple>${body}</simple>
            <!-- For each change, we execute a sub-routine -->
            <to uri="direct:line"/>
        </split>
    </route>
    <route>
        <from uri="direct:line"/>
        <log message="${body}"/>
        <choice>
            <when>
                <simple>${body.newValue} != null and ${body.newValue} == "true"</simple>
                <setBody>
                    <u:map-create>
                        <u:map-entry key="paymentId">
                            <header>paymentId</header>
                        </u:map-entry>
                        <u:map-entry key="resolution">
                            <simple>${body.vt}</simple>
                        </u:map-entry>
                    </u:map-create>
                </setBody>
                <log message="Creating alarm on payment: ${header[paymentId]}"/>
                <!-- If the payment is in failure we create an alarm -->
                <to uri="tnd-absorption:createAlarm"/>
            </when>
        </choice>
    </route>
</routes>

Start the route.

Acknowledgement

Create a datagrid with Payment in rows, filtered with "failureStatus equals true", and add a value mashlet to display the failureStatus attribute value.

Create another datagrid next to the first one. Add FailedPaymentAlarm entity in rows and add an Acknowledge mashlet. Set the Status input attribute to status of FailedPaymentAlarm.

You now have a dashboard that let you acknowledge alarms for failed payments.

Related Links