View Result

Users have to perform the following steps to view the results of an action performed:

  • Create action rule and remember the rule ID

  • Get the rule details using the rule ID and check if the rule is created properly or not

  • Start rule using rule ID

  • Publish or pump data in Action Service.

  • Check the result.

Publish Data

Data can be published into Action Service through the following three mediums:

  • Message Routing SendRequest API: This is an additional API available in MR for posting data to MR input.

  • SOS: SOS is Sensor Observation Service. Users can pump data using SOS post observation API.

  • DM: DM is Device Management service which registers the devices which posts data directly to MR.

Please refer to the section below for details of each medium.

Message Routing

Data can be pumped to Action Service using Message Routing send request API. Users have to create MR rule to route the data to Action Service input topic exchange. Users do not need to create rule if the input of Action Service is Direct Exchange.

  • POST http://<domainname>/MessageRouting/v2.0/sendRequest

Send request post data on direct exchange of the give MR rule. Here in our MR rule direct exchange name is Direct.Exchange and Routing Key is e325f4fe-a0e3-4252-82af-4c24deb8c0cf.

We have provided the same in our send request API as shown in the image below:

../../_images/sendRequest.jpg

MR rule JSON is as follows:

{
  "Status": "Stopped",
  "RuleID": 1108,
  "RuleName": "Demo rule",
  "RuleDescription": "Demo rule for user guide",
  "input": {
       "Direct Exchange Name": "Direct.Exchange",
       "Routing Key": "e325f4fe-a0e3-4252-82af-4c24deb8c0cf"
  },
  "param": {
       "feature": "",
       "sensorid": "NEXUS1",
       "starttime": "",
       "endtime": "",
       "ifCond": "",
       "thenExpr": "",
       "elseCond": "",
       "name": "ObservedProperties",
       "value": []
   },
  "output": {
      "topic Exchange name": "DemoExchange",
      "topic name": "demo1"
   }
 }

Once user clicks Try it out! button the data is sent and a success message is shown as a response from the API swagger.

Warning

If Action Service input is topic exchange then only SOS observation JSON can be send.

SOS

Users can pump data using SOS post observation API. SOS will post the data to Direct Exchange. If the input of Action Service is topic exchange then a MR rule needs to be present as above which will route the data to topic exchange.

  • POST http://<domainname>/api/sos/v2.0/observations

The swagger image for post observation API

../../_images/sospost1.png ../../_images/sospost2.png

DM

Device Management service can also be used to publish data into Action Service input. Please refer to the DM user guide for more details.

Check Result

There are different methods for different action types to check if the action is performed successfully or not.

RDBMS

Users need to go to the database and run SQL query to check the data inserted.

Callback URL

Users need to check the external service.

Push Notification

The data will come as notification in the mobile. Users can open the notification to view the full message.

The image for notification of push message is as follows:

../../_images/android8.png

Users view the data as the following image after opening the notification.

../../_images/android9.png

Syslog

User can check the syslog file in the system.

SOS

Users can call SOS GET observations API to check the data inserted in SOS.

GET http://<domain name>/api/sos/v2.0/observations

The following image shows the swagger page of get observations:

../../_images/sosobs1.png ../../_images/sosobs2.png

View Status

Users can view a specfic rule success and error status by subscribing to a topic. Subscription can be done using code, SSE viewer or Websocket.

Users can also view the error if statistics.level="ERROR" is set in the configuartion file.

The Websocket service image of subscription to a topic for a rule is as follows:

../../_images/stat4.PNG

Note

  • Topic exchange name and topic name is configurable at the time of running the service.

  • The default topic exchange name is statExchange and topic name is statTopic_{rule_id}.