...
<Waiting on snippet on setting up STOMP handler>
Subscribing to a Topic
Code Block | ||
---|---|---|
| ||
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 .
...
The payload for an event includes:
key | value |
---|---|
uuid | Zone uuid of target resource |
name | Zone display name of target resource |
description | Description of event |
date | Timestamp of when event occurred (TBD) |
optional | Other key/values that are appropriate for the event type |
Requesting Notification Log
...