Minor change, augmented logging quality
This commit is contained in:
+9
-5
@@ -237,9 +237,13 @@ class ProtocolProcessor implements EventHandler<ValueEvent> {
|
|||||||
* */
|
* */
|
||||||
private void publish2Subscribers(String topic, AbstractMessage.QOSType qos, ByteBuffer message, boolean retain, Integer messageID) {
|
private void publish2Subscribers(String topic, AbstractMessage.QOSType qos, ByteBuffer message, boolean retain, Integer messageID) {
|
||||||
LOG.debug("publish2Subscribers republishing to existing subscribers that matches the topic {}", topic);
|
LOG.debug("publish2Subscribers republishing to existing subscribers that matches the topic {}", topic);
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("subscription tree {}", subscriptions.dumpTree());
|
||||||
|
}
|
||||||
for (final Subscription sub : subscriptions.matches(topic)) {
|
for (final Subscription sub : subscriptions.matches(topic)) {
|
||||||
LOG.debug("Broker publishing to client <{}> topic <{}> qos <{}>",
|
LOG.debug("Broker republishing to client <{}> topic <{}> qos <{}>, active {}",
|
||||||
sub.getClientId(), sub.getTopic(), qos);
|
sub.getClientId(), sub.getTopic(), qos, sub.isActive());
|
||||||
|
|
||||||
if (qos == AbstractMessage.QOSType.MOST_ONE) {
|
if (qos == AbstractMessage.QOSType.MOST_ONE) {
|
||||||
//QoS 0
|
//QoS 0
|
||||||
sendPublish(sub.getClientId(), topic, qos, message, false);
|
sendPublish(sub.getClientId(), topic, qos, message, false);
|
||||||
@@ -269,7 +273,7 @@ class ProtocolProcessor implements EventHandler<ValueEvent> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendPublish(String clientId, String topic, AbstractMessage.QOSType qos, ByteBuffer message, boolean retained, int messageID) {
|
private void sendPublish(String clientId, String topic, AbstractMessage.QOSType qos, ByteBuffer message, boolean retained, int messageID) {
|
||||||
LOG.debug("notify invoked with event ");
|
LOG.debug("sendPublish invoked clientId <{}> on topic <{}> QoS {} ratained {} messageID {}", clientId, topic, qos, retained, messageID);
|
||||||
PublishMessage pubMessage = new PublishMessage();
|
PublishMessage pubMessage = new PublishMessage();
|
||||||
pubMessage.setRetainFlag(retained);
|
pubMessage.setRetainFlag(retained);
|
||||||
pubMessage.setTopicName(topic);
|
pubMessage.setTopicName(topic);
|
||||||
@@ -287,7 +291,7 @@ class ProtocolProcessor implements EventHandler<ValueEvent> {
|
|||||||
}
|
}
|
||||||
LOG.debug("clientIDs are {}", m_clientIDs);
|
LOG.debug("clientIDs are {}", m_clientIDs);
|
||||||
if (m_clientIDs.get(clientId) == null) {
|
if (m_clientIDs.get(clientId) == null) {
|
||||||
throw new RuntimeException(String.format("Can't find a ConnectionDescriptor for client %s in cache %s", clientId, m_clientIDs));
|
throw new RuntimeException(String.format("Can't find a ConnectionDescriptor for client <%s> in cache <%s>", clientId, m_clientIDs));
|
||||||
}
|
}
|
||||||
LOG.debug("Session for clientId {} is {}", clientId, m_clientIDs.get(clientId).getSession());
|
LOG.debug("Session for clientId {} is {}", clientId, m_clientIDs.get(clientId).getSession());
|
||||||
// m_clientIDs.get(clientId).getSession().write(pubMessage);
|
// m_clientIDs.get(clientId).getSession().write(pubMessage);
|
||||||
@@ -407,7 +411,7 @@ class ProtocolProcessor implements EventHandler<ValueEvent> {
|
|||||||
* doesn't reply any error
|
* doesn't reply any error
|
||||||
*/
|
*/
|
||||||
void processUnsubscribe(ServerChannel session, String clientID, List<String> topics, int messageID) {
|
void processUnsubscribe(ServerChannel session, String clientID, List<String> topics, int messageID) {
|
||||||
LOG.debug("processSubscribe invoked");
|
LOG.debug("processUnsubscribe invoked, removing subscription on topics {}, for clientID <{}>", topics, clientID);
|
||||||
|
|
||||||
for (String topic : topics) {
|
for (String topic : topics) {
|
||||||
subscriptions.removeSubscription(topic, clientID);
|
subscriptions.removeSubscription(topic, clientID);
|
||||||
|
|||||||
+1
-1
@@ -88,6 +88,6 @@ public class Subscription implements Serializable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("[t:%s, cliID: %s, qos: %s]", this.topic, this.clientId, this.requestedQos);
|
return String.format("[t:%s, cliID: %s, qos: %s, active: %s]", this.topic, this.clientId, this.requestedQos, this.active);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user