use of org.eclipse.che.ide.websocket.rest.SubscriptionHandler in project che by eclipse.
the class AbstractMessageBus method processSubscriptionMessage.
/**
* Process the {@link Message} that received by subscription.
*
* @param message
* {@link Message}
*/
private void processSubscriptionMessage(Message message) {
String channel = getChannel(message);
List<MessageHandler> subscribersSet = channelToSubscribersMap.get(channel);
if (subscribersSet != null) {
for (MessageHandler handler : subscribersSet) {
//TODO this is nasty, need refactor this
if (handler instanceof SubscriptionHandler) {
((SubscriptionHandler) handler).onMessage(message);
} else {
handler.onMessage(message.getBody());
}
}
}
}
Aggregations