SAP Digital Vehicle Hub – Enterprise Messaging Service
SAP has recently launched the new product SAP Digital Vehicle Hub.
This blog post is part of a blog series. The initial blog post comprises a general introduction to SAP Digital Vehicle Hub and an overview about the other topics of this blog series.
In this blog post we will focus on the event management with SAP Digital Vehicle Hub and SAP Cloud Platform Enterprise Messaging.
We will use the already introduced Rinspeed MetroSnap vehicle to explore the features of enterprise messaging in conjunction with SAP Digital Vehicle Hub. The scenario is that an end user is changing data of a vehicle object in the UI of SAP Digital Vehicle Hub. This will trigger an event that can then be consumed by a secondary application.
Overview – Enterprise Messaging
SAP Cloud Platform Enterprise Messaging (EMS) is a service in the Cloud Foundry environment that allows applications to communicate through asynchronous events. This enables an extension of the digital core by creating applications that work independently but participate in event-driven business processes.
An event is a notable change in state of an object, for example a change of a vehicle object in SAP Digital Vehicle Hub. A receiving application can then subscribe to this event to receive the change notification.
In a bit more technical view, a sending application (e.g. SAP Digital Vehicle Hub) is publishing a message to a specific topic in EMS. Within EMS a topic is then bound to a queue. Once the event is triggered for a certain topic, the message will stay within the queue until the receiving applications is consuming the message.
For further details on the concept of SAP Enterprise Messaging, please refer to SAP Help: https://help.sap.com/viewer/bf82e6b26456494cbdd197057c09979f/Cloud/en-US/e87534178ff448139efa93d639f13299.html
Available Business Events
SAP Digital Vehicle Hub currently provides events for the creation of a vehicle and the update or change of a vehicle. SAP Digital Vehicle Hub is publishing these events to the following topics:
The events have the following standard attributes:
|id||String||Identifies the event|
|source||URI-reference||Identifies the instance in which the event originated.|
|specversion||String||The version of the CloudEvents specification which the event uses.|
|type||String||Describes the type of the event related to the source in which the event originated.|
|datacontenttype||String||Content type of the data attribute.|
|subject||String||Describes the subject of the event in the context of the source in which the event originated. For example, a certain business object or a resource.|
|time||Timestamp||Timestamp of when the event occurred.|
|data||Application or json object||The payload of the event.|
An example for a message is presented later in the blog post.
The business events are described in detail on SAP API Business Hub: https://api.sap.com/package/SAPDigitalVehicleHubBusinessEvents
Connecting to SAP Cloud Platform Enterprise Messaging
The main steps for setting up the connection from SAP Digital Vehicle Hub to SAP Cloud Platform Enterprise Messaging are:
- Create a subaccount on SCP and subscribe to SAP Cloud Platform Enterprise Messaging
- Assign role collection for Enterprise Messaging to users
- Create a Service Instance for SAP Cloud Platform Enterprise Messaging in a space of the same subaccount.
For further details, please refer to the SAP Digital Vehicle Hub Administration Guide: https://help.sap.com/viewer/6d83a7f380b741f087e8f1401e2ec576/latest/language/752fd0dde05a4acea05bff7b8693da2a.html
Subscribe to SAP Digital Vehicle Hub topics
After the service instance has been created in the SAP Cloud Platform, you can see the instance also in SAP Cloud Platform Enterprise Messaging:
As a next step, the subscription to the SAP Digital Vehicle Hub topics has to be configured. For that, we first have to create a queue within the instance and then subscribe the queue to the topics vehicleCreate and vehicleUpdate.
1. Firstly, open the instance in SAP Cloud Platform Enterprise Messaging and then click on Create Queue to create a queue with name test (no further changes are necessary in the default configuation). Afterwards the queue is available:
Now the configuration part is done and we can consume events triggered by changes of vehicles or by creation of vehicles in SAP Digital Vehicle Hub.
Changing Data in SAP Digital Vehicle Hub
As a next step, we will change our Rinspeed vehicle to test if the corresponding event is triggered. Therefore, we open the Modify Vehicle app of SAP Digital Vehicle Hub and select our Rinspeed vehicle:
In the Vehicle Information section of the vehicle, we navigate to Configuration and then click on Edit. This allows us now to change the configuration data, for example the Exterior Color to Green:
After saving the changes in SAP Digital Vehicle Hub, we navigate to Enterprise Messaging and to the instance where we have created the queue and the topic subscription.
Now we can test if the change of the exterior color has been captured by SAP Cloud Platform Enterprise Messaging.
- Open the created instance in SAP Cloud Platform Enterprise Messaging
- Navigate to Test and select the created queue test. There you should then see that at least one message is available. In order to display the message, click on Consume Message:
The message that has been triggered by the change of the exterior color is as follows:
In the data section of the message, we can now see the changed aspects. As we have changed the configuration, the changed aspect type is vehicleSpecification and we can also see that the exteriorColor is changed to Green.
Consuming the message from the test cockpit of SAP Cloud Platform Enterprise Messaging is of course only for demonstrative purposes. In a project or productive scenario, the same message could be consumed by any other application.
This could be for instance SAP Cloud Platform Integration that is then handling the corresponding mappings to finally update external systems that are connected to SAP Digital Vehicle Hub. Another use case could be a side-by-side extension on SAP Cloud Platform that for example receives updates from SAP Digital Vehicle Hub whenever a vehicle is created so that follow-up business processes can be triggered.
This blog post briefly covered the general approach to use SAP Cloud Platform Enterprise Messaging Service in combination with SAP Digital Vehicle Hub, from configuring the Enterprise Messaging Service to consume the event triggered by a change in SAP Digital Vehicle Hub.
Have a look on the other post of this blog post series, all linked from the initial blog post or ask a question in the Intelligent Asset Management Community.
SAP Digital Vehicle Hub Product homepage: SAP Digital Vehicle Hub.
SAP Digital Vehicle Hub Help Portal: https://help.sap.com/viewer/product/SAP_DIGITAL_VEHICLE_HUB
SAP API Business Hub: https://api.sap.com/
SAP Cloud Platform Enterprise Messaging: https://help.sap.com/viewer/product/SAP_ENTERPRISE_MESSAGING/Cloud/en-US