Skip to Content

Tutorial – Introduction

MQTT is a machine to machine protocol which supports a lightweight version of publish/subscribe messaging transport. It is therefore mostly used in Internet of Things (IoT) scenario. Typically speaking, devices will need to send messages to a MQTT broker.

For customers and partners using SAP, Rojo Consultancy B.V has developed a MQTT adapter for the SAP Hana Cloud Platform, Integration Services (SAP HCI). To read more about this adapter, refer to:

http://www.rojoconsultancy.com/en/products/mqtt-adapter

This tutorial will give you a step by step demonstration of how you can use the SAP HCI MQTT adapter.

Note that the MQTT adapter is not available by default in your SAP HCI tenant. You will need to purchase it from Rojo Consultancy.


For those who like to gain a deeper understanding of SAP HCI, you can refer to our book:

https://www.sap-press.com/sap-hana-cloud-integration_3979/


Scenario

You have a number of devices deployed in the field. For sake of simplicity, assume that these are vending machines for selling different types of cookies. As the company owning the vending machines, you would like to have direct access (online) of the events happing on the vending machines.

For simplicity sake, assumes that these devices are pushing their events at mosquitto.org publicly available MQTT server. Mosquitto provides a free MQTT broker that can be used to ease your exploration of what is possible with our MQTT adapter.


Pic1-(1).jpg

Figure 1. Scenario


Because the focus of this article is how to use the MQTT adapter, to show case the feature of both sender and receiver adapter, we will pick the message from one MQTT topic (using the sender MQTT adapter) and push the message to another MQTT topic (using the receiver MQTT adapter). This scenario is depicted in the above Figure. We are assuming that your devices are already sending data to the MQTT broker.

Solution: Create a simple integration flow with the MQTT Adapter

Requirements

Step 1. Create an integration package in SAP HCI

  1. Launch SAP HCI Web application by accessing the URL provided by SAP.
  2. If you are a new user, choose Signup.
  3. If you have user credentials, choose Login.

Pic2.jpg        

Figure 2. SAP HCI – Home


  1. Select  Pic3.jpg and choose the Design tab.
  2. Choose Create and insert the required data to create a new Integration Package.

Pic4.jpg

Figure 3. SAP HCI – New Integration Package

Step 2. Create and add a new integration flow in SAP HCI

  1. Choose Add, and select Process Integration to add a new integration flow as an artifact.
  2. Select Create and enter the required data.

Pic5.jpg

Figure 4. SAP HCI – Add Process Integration Artifact


Choose Ok to add the process integration artifact.

  1. Choose Save to keep the integration package.

Step 3. Assign MQTT Adapter to integration flow in SAP HCI

  1. Click on the integration flow artifact name and choose Edit.

Pic6.jpg

Figure 5. SAP HCI –  Configuration Integration Flow

  1. Select Sender and choose /wp-content/uploads/2016/09/drag_1027671.jpgto drag the pointer to Start to define the sender channel.
  2. Choose MQTT adapter.

 

Pic7.jpg

Figure 6. SAP HCI – Choose Adapter Type

  1. Select End and choose  /wp-content/uploads/2016/09/drag_1027671.jpgto drag the pointer to Receiver to define the receiver channel.
  2. Choose MQTT adapter.

Pic8.jpg

Figure 7. SAP HCI – Configuration Integration Flow with Sender and Receiver MQTT Adapter

Step 4. Configure Sender MQTT Adapter in SAP HCI

  1. Choose Edit.
  2. Select the Sender MQTT adapter, select General tab and enter the required data into fields Name and Description.

Pic9.jpg

Figure 8. SAP HCI – General Tab in Sender MQTT Adapter

  1. Select Adapter Specific tab and enter the data into Connection Details. In this scenario mosquito.org is used, with port 1883. Topic name can be anything and “/” indicates a topic level separator.

Pic10.jpg

Figure 9. SAP HCI – Adapter Specific Tab in Sender MQTT Adapter

  1. Select Advanced tab and insert the data into Advanced Option.

Pic11.jpg

Figure 10. SAP HCI – Advanced Tab in Sender MQTT Adapter

  1. Choose Save to keep this configuration of the Sender MQTT adapter.

Step 5. Configure Receiver MQTT Adapter in SAP HCI

  1. Select Provider MQTT adapter, select General tab and insert the required data into fields Name and Description.

Pic12.jpg

Figure 11. SAP HCI – General Tab in Receiver MQTT Adapter

  1. Select Adapter Specific tab and insert the data in section Connection Details.

Pic13.jpg

Figure 12. SAP HCI – Adapter Specific Tab in Receiver MQTT Adapter

  1. Select Advanced tab and insert the data into Advanced Option, similar to the Sender MQTT Adapter configuration.

Pic14.jpg

Figure 13. SAP HCI – Advanced Tab in Receiver MQTT Adapter

The Last Will and Testament tab is not configured in this tutorial.

  1. Choose Save to keep this configuration of the Receiver MQTT adapter and choose Deploy.

Pic15.jpg

Figure 14. SAP HCI – Integration Flow Triggered for Deployment

And voila! You have finished your configuration and can now proceed with testing.

For the purpose of testing, you can use any MQTT client of your choice (like MQTT fx)  to place a file in the topic that the sender adapter is reading. e.g: “amsterdam/buildingA/floor1/temperature”.


Reference

You can also find more information on this adapter at:

Youtube: https://www.youtube.com/watch?v=848tjsv3eiU

Webinar: http://go.sap.com/assetdetail/2016/07/16ab8200-807c-0010-82c7-eda71af511fa.html

To report this post you need to login first.

7 Comments

You must be Logged on to comment or reply to a post.

Leave a Reply