Removed the CleanInFlight evente, because the clean is done once the Publish QoS 1 is just published
This commit is contained in:
@@ -139,9 +139,6 @@ public class SimpleMessaging implements IMessaging, EventHandler<ValueEvent> {
|
||||
DisconnectEvent disEvt = (DisconnectEvent) evt;
|
||||
String clientID = (String) disEvt.getSession().getAttribute(Constants.ATTR_CLIENTID);
|
||||
processDisconnect(disEvt.getSession(), clientID);
|
||||
} else if (evt instanceof CleanInFlightEvent) {
|
||||
//remove the message from inflight storage
|
||||
m_storageService.cleanInFlight(((CleanInFlightEvent) evt).getMsgId());
|
||||
} else if (evt instanceof RepublishEvent) {
|
||||
processRepublish((RepublishEvent) evt);
|
||||
} else if (evt instanceof ProtocolEvent) {
|
||||
@@ -284,13 +281,11 @@ public class SimpleMessaging implements IMessaging, EventHandler<ValueEvent> {
|
||||
final byte[] message = evt.getMessage();
|
||||
boolean retain = evt.isRetain();
|
||||
|
||||
CleanInFlightEvent cleanEvt = null;
|
||||
|
||||
String publishKey = null;
|
||||
if (qos == QOSType.LEAST_ONE) {
|
||||
//store the temporary message
|
||||
String publishKey = String.format("%s%d", evt.getClientID(), evt.getMessageID());
|
||||
publishKey = String.format("%s%d", evt.getClientID(), evt.getMessageID());
|
||||
m_storageService.addInFlight(evt, publishKey);
|
||||
cleanEvt = new CleanInFlightEvent(publishKey);
|
||||
}
|
||||
|
||||
for (final Subscription sub : subscriptions.matches(topic)) {
|
||||
@@ -310,8 +305,9 @@ public class SimpleMessaging implements IMessaging, EventHandler<ValueEvent> {
|
||||
}
|
||||
}
|
||||
|
||||
if (cleanEvt != null) {
|
||||
refill(cleanEvt);
|
||||
if (qos == QOSType.LEAST_ONE) {
|
||||
assert publishKey != null;
|
||||
m_storageService.cleanInFlight(publishKey);
|
||||
sendPubAck(new PubAckEvent(evt.getMessageID(), evt.getClientID()));
|
||||
}
|
||||
|
||||
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
package org.dna.mqtt.moquette.messaging.spi.impl.events;
|
||||
|
||||
/**
|
||||
* Message to remove the message of type QoS 1 or 2 from in flight store
|
||||
*/
|
||||
public class CleanInFlightEvent extends MessagingEvent {
|
||||
|
||||
private String m_msgId;
|
||||
|
||||
public CleanInFlightEvent(String msgId) {
|
||||
m_msgId = msgId;
|
||||
}
|
||||
|
||||
public String getMsgId() {
|
||||
return m_msgId;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user