Пример #1
0
 private void sendPubRec(String clientID, int messageID) {
   LOG.trace(
       "PUB <--PUBREC-- SRV sendPubRec invoked for clientID {} with messageID {}",
       clientID,
       messageID);
   PubRecMessage pubRecMessage = new PubRecMessage();
   pubRecMessage.setMessageID(messageID);
   m_clientIDs.get(clientID).session.write(pubRecMessage);
 }
Пример #2
0
  public void processPubRec(ServerChannel session, PubRecMessage msg) {
    String clientID = (String) session.getAttribute(NettyChannel.ATTR_KEY_CLIENTID);
    int messageID = msg.getMessageID();
    ClientSession targetSession = m_sessionsStore.sessionForClient(clientID);
    verifyToActivate(clientID, targetSession);
    // remove from the inflight and move to the QoS2 second phase queue
    targetSession.inFlightAcknowledged(messageID);
    targetSession.secondPhaseAckWaiting(messageID);
    // once received a PUBREC reply with a PUBREL(messageID)
    LOG.debug(
        "\t\tSRV <--PUBREC-- SUB processPubRec invoked for clientID {} ad messageID {}",
        clientID,
        messageID);
    PubRelMessage pubRelMessage = new PubRelMessage();
    pubRelMessage.setMessageID(messageID);
    pubRelMessage.setQos(AbstractMessage.QOSType.LEAST_ONE);

    session.write(pubRelMessage);
  }