This document provides client application developers the background needed to subscribe to YOUnite MDM notification topics and event types so they can receive real-time updates to MDM events. A topic is created for each MDM zone and for each MDM zone there are various notification types.
Subscribing to Topics
MDM uses the Apache ActiveMQ messaging system which leverages the STOMP text-based messaging protocol. STOMP allows clients to be written easily. A STOMP protocol implementation in node.js can be found here.
Adding STOMP
<Waiting on snippet on adding STOMP>
Configuring STOMP
Adding STOMP Handler
Subscribing to a Topic
subscribeNotification() {
this.loggedInZoneUuid = localStorage.getItem('zoneUuid');
this.client = Stomp.client(Config.ACTIVEMQ_CLIENT);
let topicUrl = '/topic/' + this.loggedInZoneUuid;
let connectHeaders = {
login: Config.ACTIVEMQ_USER_NAME,
passcode: Config.ACTIVEMQ_PASSWORD,
'client-id': this.loggedInZoneUuid
};
let componentRef = this;
let callback = function (message) {
// called when the client receives a STOMP message from the server
componentRef.toastr.info(message.body);
componentRef.incrementUnreadNotificationCount();
};
let subscribeHeaders = {'activemq.subscriptionName': this.loggedInZoneUuid};
this.client.connect(connectHeaders, function () {
componentRef.client.subscribe(topicUrl, callback, subscribeHeaders);
}
);
}
Notification Types
The following is list of event types that a subscriber can be notified of on a per zone (topic) basis. Each time an event is triggered it publishes a new notification of a given event type .
Event | Event Type | Default Scope |
---|---|---|
A zone is created | ZONE_POST | |
A zone is updated | ZONE_PUT | |
A zone is deleted | ZONE_DELETE | |
A zone's thumbnail image is updated | ZONE_THUMBNAIL_PUT | |
A data domain is created or a new version of of the data domain has been created | DOMAIN_POST | |
A data domain has been created | DOMAIN_PUT | |
A data domain has been deleted | DOMAIN_DELETE | |
?? | DOMAIN_NAME_POST | |
A data domain has been updated | DOMAIN_NAME_PUT | |
? | DOMAIN_DATA_POST | |
? | DOMAIN_DATA_DELETE | |
An MDR has been created for a given data domain | DOMAIN_NAME_DATA_POST | |
An MDR has been updated in a given data domain. | DOMAIN_NAME_DATA_PUT | |
An MDR has been deleted in a give data domain. | DOMAIN_NAME_DATA_DELETE |
Payload
The payload for an event includes:
Key | Description |
---|---|
Event Type (see above) | |
Originating zone UUID | |
Originating zone name | |
Status | |
Description | |
Message | |
Date Created | |
Key/Value map with additional information (NOTE: that should be documented for each event type) |
Requesting Notification Log
A client can make a request to get the log history for all notifications sent to their zone. The user provides their zone and a from and to date.