Merge pull request #224 from bcw104/master
broker: notify when client connection lost
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user