Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Murali_Shanmu
Active Contributor

Few months back, Message Processing functionality was introduced in HANA Cloud Platform IoT services. This provides more flexibility to process incoming messages. You no longer need to persist the messages in HCP, you could either forward the incoming message to a web service, message broker or Smart Data Streaming depending on your requirements.

In this blog, I am going to focus on the SQL message processing option. This is the default processing service which stores all the incoming messages in a database table. If none of these options are maintained, we have seen how MMS automatically creates a message table with a name which matches the Message type ID. It follows the naming scheme T_IOT_[Message Type ID]. You also would recollect that there would be two columns named G_DEVICE and G_CREATED which represent the device ID and timestamp when the message was stored in the table. All the remaining message fields would be mapped to a column prefixed with C_.

With SQL Message processing service, you longer need to stick to a I_IOT_MessageID table with such column definitions. You can create your own table, in your own schema and have columns with the name you provide.

Navigate to the HCP IoT services cockpit to create Message Type/Device Type and Devices

In the below screen, I have created a message type with two fields

I have assigned the message type to a device type.

Finally I have created a Device for the above device type.


Processing service can be either managed by the User Interface (MMS Cockpit) or via Processing service APIs. I am going to show how to do it with APIs. The structure of the payload should be same as mentioned in SAP Help.

I am using a REST client to create a service mapping

URL: https://iotmms<account-name>.<HCP Landscape>/com.sap.iotservices.mms/v1/api/http/processing

Action: PUT

In the payload, I provide the new table name along with the mappings of the message fields with table columns. Notice that I have set "add_default_columns" to true. This will automatically add G_DEVICE and G_CREATED columns in the table.

When I click on SEND, it would provide a below response stating that the service mapping has been registered.

Navigate to the MSS cockpit and click on the “Configure Processing Service Mappings”

You will notice there is a Processing service entry of type SQL. If you want to add more service mappings, you could do it straight from this UI too.                     

You can select it to explore the Message Type and Device Type associated with it.

In the detail screen, you will be able to verify the table name along with the message field mappings to table columns


Now, we can test the message by using the test client provided in MMS cockpit.


I am going to use HTTP APIs to test the IoT messages from thecockpit


Below is my sample message

You will notice a success message as shown below

To view the data which is persisted in the database table, navigate to “Display Stored messages” tile

This should list all tables associated with the IoT Services. You should be able to see the new table which you had associated with the message type earlier.

You can also open this table in HANA Web based Workbench and explore the data records

You can use the Service mappings to create a flexible chain of message processing by forwarding the IoT messages to other web services and event stream processors. I have also posted on how to configure Service mappings for Smart Data Streaming in Capture event streams from IoT devices and perform predictive analytics using HCP - Part 4

15 Comments
Labels in this area