User Experience Insights
Developing a CAP Application Integrating MQTT with Integration Suite
This blog post is part of a series of posts describing an integration project which connects the with the production planning capabilities of an on-premise S/4HANA system. This project was realized by students at FH Aachen – University of Applied Sciences with great support by project partners at oee.ai and SAP. You can check out the main article describing the project .
In this tutorial video you will learn how to build an application capable of receiving messages and reacting to them and how to safely deploy it to a Cloud Foundry space on BTP. To accomplish this goal, several SAP technologies such as the and the are utilized.
Background
During our integration — as described in the of this series of blog posts — it was necessary to build such an application. Our use case was that we needed to synchronize production orders marked as finished in our oee.ai system with our S/4HANA system by creating according production order confirmations. A production order is deemed finished as soon as the desired number of produced units defined for the production order is reached.
To accomplish this behavior, our application first connects to the MQTT broker of oee.ai. It then continuously receives messages indicating a finished production order. Once such a message is received, an integration flow is triggered handling the confirmation of the production order in S/4HANA. You can read more about this process .
We needed to develop this part of the integration ourselves because there currently is no standard way to listen and react to MQTT messages inside . We were required to use Integration Suite though because the information about a finished production order is processed further by an integration flow created in Integration Suite.
Tutorial video
Prerequisites
-
Access to SAP BTP. A with the necessary entitlements for the services used works as well.
-
-
An SAP user account not using SAP Universal ID for authentication
-
Here’s why Universal ID won’t work: We use the BTP CI/CD service to deploy to a Cloud Foundry space. The CI/CD service however does that by programmatically accessing the Cloud Foundry space using the according CLI which requires authentication. But to authenticate via the CLI using SAP Universal ID, (scroll down to the last note) which is not practicable in the context of an automated CI/CD job.
-
This account can be different from the account used to set everything up in BTP. Just make sure to to the account to be able to access the Cloud Foundry space to deploy to.
-
-
An empty Git repository to store the code base of the application, preferably hosted on GitHub or a GitLab instance. Make sure to have it to your local system.
-
installed, preferably the latest LTS version
-
Any editor or IDE supporting Node.js
-
e.g. , the editor used throughout the tutorial video
-
Resources
-
as shown in the video
-
-
(VS Code only)
-
(for
mta.yaml
)
Additional notes
-
To find the endpoint URL provided for your integration flow, open your Integration Suite instance. Select Monitor → Overview → Manage Integration Content and then the integration flow in question.
-
node-fetch and node-jose are required for the boilerplate code used to access the credential store.
-
I did not write the specific code present in
credStore.js
using these dependencies myself and instead relied on the available in
-
-
node-fetch version 3 because CAP doesn’t seem to support ES modules yet.