Added missing persist on QoS1 retained publish

This commit is contained in:
andsel
2017-04-30 11:31:05 +02:00
parent 406ffd10db
commit 85a787993c
3 changed files with 9 additions and 5 deletions
@@ -59,11 +59,11 @@ class MessagesPublisher {
void publish2Subscribers(IMessagesStore.StoredMessage pubMsg, Topic topic, int messageID) { void publish2Subscribers(IMessagesStore.StoredMessage pubMsg, Topic topic, int messageID) {
if (LOG.isTraceEnabled()) { if (LOG.isTraceEnabled()) {
LOG.trace("Sending publish message to subscribers. ClientId={}, topic={}, messageId={}, payload={}, " + LOG.trace("Sending publish message to subscribers. CId={}, topic={}, messageId={}, payload={}, " +
"subscriptionTree={}", pubMsg.getClientID(), topic, messageID, DebugUtils.payload2Str(pubMsg.getPayload()), "subscriptionTree={}", pubMsg.getClientID(), topic, messageID, DebugUtils.payload2Str(pubMsg.getPayload()),
subscriptions.dumpTree()); subscriptions.dumpTree());
} else { } else {
LOG.info("Sending publish message to subscribers. ClientId={}, topic={}, messageId={}", pubMsg.getClientID(), topic, LOG.info("Sending publish message to subscribers. CId={}, topic={}, messageId={}", pubMsg.getClientID(), topic,
messageID); messageID);
} }
publish2Subscribers(pubMsg, topic); publish2Subscribers(pubMsg, topic);
@@ -510,7 +510,7 @@ public class ProtocolProcessor {
this.qos2PublishHandler.receivedPublishQos2(channel, msg); this.qos2PublishHandler.receivedPublishQos2(channel, msg);
break; break;
default: default:
LOG.error("Unkonwn QoS-Type:{}", qos); LOG.error("Unknown QoS-Type:{}", qos);
break; break;
} }
} }
@@ -19,6 +19,7 @@ package io.moquette.spi.impl;
import io.moquette.server.ConnectionDescriptorStore; import io.moquette.server.ConnectionDescriptorStore;
import io.moquette.server.netty.NettyUtils; import io.moquette.server.netty.NettyUtils;
import io.moquette.spi.IMessagesStore; import io.moquette.spi.IMessagesStore;
import io.moquette.spi.MessageGUID;
import io.moquette.spi.impl.subscriptions.Subscription; import io.moquette.spi.impl.subscriptions.Subscription;
import io.moquette.spi.impl.subscriptions.SubscriptionsStore; import io.moquette.spi.impl.subscriptions.SubscriptionsStore;
import io.moquette.spi.impl.subscriptions.Topic; import io.moquette.spi.impl.subscriptions.Topic;
@@ -78,8 +79,11 @@ class Qos1PublishHandler extends QosPublishHandler {
m_messagesStore.cleanRetained(topic); m_messagesStore.cleanRetained(topic);
} else { } else {
// before wasn't stored // before wasn't stored
//MessageGUID guid = m_messagesStore.storePublishForFuture(toStoreMsg); MessageGUID guid = m_messagesStore.storePublishForFuture(toStoreMsg);
m_messagesStore.storeRetained(topic, toStoreMsg.getGuid());
//TODO Il messaggio non ha il guid settato
// m_messagesStore.storeRetained(topic, toStoreMsg.getGuid());
m_messagesStore.storeRetained(topic, guid);
} }
} }