Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

<Waiting on snippet on setting up STOMP handler>

Subscribing to a Topic

<Waiting on snippet for subscribing>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  .  

...