Merge pull request #224 from bcw104/master

broker: notify when client connection lost
This commit is contained in:
Andrea Selva
2016-11-05 17:08:09 +01:00
committed by GitHub
7 changed files with 50 additions and 6 deletions
@@ -72,6 +72,18 @@ final class BrokerInterceptor implements Interceptor {
}
}
@Override
public void notifyClientConnectionLost(final String clientID, final String username) {
for (final InterceptHandler handler : this.handlers) {
executor.execute(new Runnable() {
@Override
public void run() {
handler.onConnectionLost(new InterceptConnectionLostMessage(clientID, username));
}
});
}
}
@Override
public void notifyTopicPublished(final PublishMessage msg, final String clientID, final String username) {
for (final InterceptHandler handler : this.handlers) {
@@ -704,6 +704,9 @@ public class ProtocolProcessor {
forwardPublishWill(will, clientID);
m_willStore.remove(clientID);
}
String username = NettyUtils.userName(channel);
m_interceptor.notifyClientConnectionLost(clientID, username);
}
/**