@Override
public void publishEvent(TopicEvent event) {
super.publishEvent(event);
if (event instanceof SessionSubscriptionEvent) {
SessionSubscriptionEvent subscriptionEvent = (SessionSubscriptionEvent) event;
getOrCreatePublishingContext(subscriptionEvent.getTopicKey()).addSession(subscriptionEvent.getSession());
} else if (event instanceof SessionUnsubscriptionEvent) {
SessionUnsubscriptionEvent unsubscriptionEvent = (SessionUnsubscriptionEvent) event;
getPublishingContext(unsubscriptionEvent.getTopicKey()).removeSession(unsubscriptionEvent.getSession());
}