broker: notify when client connection lost

This commit is contained in:
bcw
2016-10-21 10:28:36 +08:00
parent cf67d5ac52
commit 03c0097641
5 changed files with 42 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);
}
/**