Bridge Data to SAP Event Mesh

EMQX Rule Engine supports sending messages to SAP Event MeshBridge data to SAP Event Mesh - 图1 (opens new window) through HTTP request (httprest).

Event Mesh is an important message exchange component of SAP BTPBridge data to SAP Event Mesh - 图2 (opens new window).

The SAP BTP includes all the technology combinations, such as SAP HANA (in memory computing platform), SAP Analytics Cloud (analysis cloud), SAP Integration Suite and SAP Extension Suite.

The IoT data of EMQX can be sent to these products of SAP BTP through this bridge.

Prepare the SAP Event Mesh environment

Prepare the SAP Event Mesh environment and obtain the service keys. For details see Create Instance of SAP Event MeshBridge data to SAP Event Mesh - 图3 (opens new window)

Take the following Service Keys as an example:

  1. {
  2. "xsappname": "some-app-name",
  3. "management": [
  4. {
  5. "oa2": {
  6. ...
  7. },
  8. "uri": "..."
  9. }
  10. ],
  11. "messaging": [
  12. {
  13. "oa2": {
  14. "clientid": "my_clientid",
  15. "clientsecret": "my_clientsecret",
  16. "tokenendpoint": "https://123trial.authentication.demo.com/oauth/token",
  17. "granttype": "client_credentials"
  18. },
  19. "protocol": [
  20. "amqp10ws"
  21. ]
  22. },
  23. {
  24. "oa2": {
  25. "clientid": "my_clientid",
  26. "clientsecret": "my_clientidsecret",
  27. "tokenendpoint": "https://123trial.authentication.demo.com/oauth/token",
  28. "granttype": "client_credentials"
  29. },
  30. "protocol": [
  31. "httprest"
  32. ],
  33. "broker": {
  34. "type": "saprestmgw"
  35. },
  36. "uri": "https://sap-messaging-pubsub.fooapps.demo.com"
  37. }
  38. ],
  39. "serviceinstanceid": "188783-7893-8765-8872-77866"
  40. }

We only care about the "messaging" field of the Service Keys, we can get the following information related to protocol: ["httprest"]:

KeyValue
Token Endpoint URIhttps://123trial.authentication.demo.com/oauth/token
Send Message URIhttps://sap-messaging-pubsub.fooapps.demo.com
ClientIdmy_clientid
ClientSecretmy_clientsecret

Then we create a message queue named “my_queue_name” in the SAP Event Mesh.

Create a rule

Open the EMQX DashboardBridge data to SAP Event Mesh - 图4 (opens new window), select the rules tab on the left.

Fill in the following rule SQL:

  1. SELECT
  2. *
  3. FROM
  4. "#"

image

Bind an action to the rule:

Click the “+ Add action” button, and then select “Data to Sap Event Mesh” in the drop-down box.

image

Fill in the following parameters for the action:

1). The message template. In this example we will send a message to SAP Event Mesh, and set the message template to:

  1. ${payload}

2). The message queue name. Here we should use the “my_queue_name” we created just now.

3). QoS. It’s the QoS of SAP Event Mesh.

4). Bind this action to a resource. Now the resource drop-down box is empty. You can click the “Create” on the right to create an SAP Event Mesh resource

Fill in the resource parameters

Here we need to fill in the information we obtained through Service Keys, including the Token Endpoint URIClientIdClientSecretSend Message URI, etc.

We keep other parameters remain the default, and then click the “test connection” button to ensure that the connection test is successful. Finally, click the “OK” button.

image

Return the action page, click the “Confirm” button.

image

Return the rule page, click the “Create” button.

image

Test by sending a message

The creation of the rule is complete. Now use an MQTT client to send a message to emqx:

  1. Topic: "t/1"
  2. QoS: 0
  3. Payload: "abc"

Now you can go to the SAP Event Mesh platform, to check whether we can fetch the message “abc” from the message queue “my_queue_name”.