예제 #1
0
  /** Specialized version to publish will testament message. */
  private void forwardPublishWill(WillMessage will, String clientID) {
    // it has just to publish the message downstream to the subscribers
    // NB it's a will publish, it needs a PacketIdentifier for this conn, default to 1
    Integer messageId = null;
    if (will.getQos() != AbstractMessage.QOSType.MOST_ONE) {
      messageId = m_messagesStore.nextPacketID(clientID);
    }

    IMessagesStore.StoredMessage tobeStored = asStoredMessage(will);
    tobeStored.setClientID(clientID);
    tobeStored.setMessageID(messageId);
    route2Subscribers(tobeStored);
  }
예제 #2
0
 private static IMessagesStore.StoredMessage asStoredMessage(WillMessage will) {
   IMessagesStore.StoredMessage pub =
       new IMessagesStore.StoredMessage(will.getPayload().array(), will.getQos(), will.getTopic());
   pub.setRetained(will.isRetained());
   return pub;
 }