Fixed issue #3, avoid hung up of broker on any message processing error
This commit is contained in:
@@ -80,5 +80,10 @@ public class NettyChannel implements ServerChannel {
|
||||
public void write(Object value) {
|
||||
m_channel.writeAndFlush(value);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String clientID = (String) getAttribute(Constants.ATTR_CLIENTID);
|
||||
return "session [clientID "+ clientID +"]";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,11 @@ public class SimpleMessaging implements IMessaging, EventHandler<ValueEvent> {
|
||||
if (evt instanceof ProtocolEvent) {
|
||||
ServerChannel session = ((ProtocolEvent) evt).getSession();
|
||||
AbstractMessage message = ((ProtocolEvent) evt).getMessage();
|
||||
annotationSupport.dispatch(session, message);
|
||||
try {
|
||||
annotationSupport.dispatch(session, message);
|
||||
} catch (Throwable th) {
|
||||
LOG.error("Grave error processing the message {} for {}", message, session, th);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-1
@@ -155,5 +155,13 @@ public class ConnectMessage extends AbstractMessage {
|
||||
public void setWillMessage(String willMessage) {
|
||||
this.m_willMessage = willMessage;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String base = String.format("Connect [clientID: %s, prot: %s, ver: %02X, clean: %b]", m_clientID, m_protocolName, m_procotolVersion, m_cleanSession);
|
||||
if (m_willFlag) {
|
||||
base += String.format(" Will [QoS: %d, retain: %b]", m_willQos, m_willRetain);
|
||||
}
|
||||
return base;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user