Peeled common code
This commit is contained in:
@@ -56,19 +56,15 @@ class MessagesPublisher {
|
||||
sub.getClientId(), sub.getTopicFilter(), qos, targetIsActive);
|
||||
ByteBuffer message = origMessage.duplicate();
|
||||
if (targetIsActive) {
|
||||
//QoS 0
|
||||
if (qos == AbstractMessage.QOSType.MOST_ONE) {
|
||||
PublishMessage publishMsg = createPublishForQos(topic, qos, message);
|
||||
this.persistentSender.publishQos2(targetSession, publishMsg);
|
||||
} else {
|
||||
PublishMessage publishMsg = createPublishForQos(topic, qos, message);
|
||||
if (qos != AbstractMessage.QOSType.MOST_ONE) {
|
||||
//QoS 1 or 2
|
||||
int messageId = targetSession.nextPacketId();
|
||||
targetSession.inFlightAckWaiting(guid, messageId);
|
||||
PublishMessage publishMsg = createPublishForQos(topic, qos, message);
|
||||
//set the PacketIdentifier only for QoS > 0
|
||||
publishMsg.setMessageID(messageId);
|
||||
this.persistentSender.publishQos2(targetSession, publishMsg);
|
||||
}
|
||||
this.persistentSender.sendPublish(targetSession, publishMsg);
|
||||
} else {
|
||||
if (!targetSession.isCleanSession()) {
|
||||
//store the message in targetSession queue to deliver
|
||||
|
||||
@@ -22,13 +22,12 @@ class PersistentQueueMessageSender {
|
||||
this.connectionDescriptors = connectionDescriptors;
|
||||
}
|
||||
|
||||
void publishQos2(ClientSession clientsession, PublishMessage pubMessage) {
|
||||
void sendPublish(ClientSession clientsession, PublishMessage pubMessage) {
|
||||
String clientId = clientsession.clientID;
|
||||
LOG.debug("directSend invoked clientId <{}> on topic <{}> QoS {} retained {} messageID {}",
|
||||
clientId, pubMessage.getTopicName(), pubMessage.getQos(), false, pubMessage.getMessageID());
|
||||
|
||||
LOG.info("send publish message to <{}> on topic <{}>", clientId, pubMessage.getTopicName());
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("directSend invoked clientId <{}> on topic <{}> QoS {} retained {} messageID {}",
|
||||
clientId, pubMessage.getTopicName(), pubMessage.getQos(), false, pubMessage.getMessageID());
|
||||
LOG.debug("content <{}>", DebugUtils.payload2Str(pubMessage.getPayload()));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user