コード例 #1
0
 private int getMessageEncodeSize(final SimpleString address) throws Exception {
   ServerLocator locator = createInVMNonHALocator();
   ClientSessionFactory cf = createSessionFactory(locator);
   ClientSession session = cf.createSession(false, true, true);
   ClientMessage message = session.createMessage(false);
   // we need to set the destination so we can calculate the encodesize correctly
   message.setAddress(address);
   int encodeSize = message.getEncodeSize();
   session.close();
   cf.close();
   return encodeSize;
 }
コード例 #2
0
  public void acknowledge(final ClientMessage message) throws ActiveMQException {
    ClientMessageInternal cmi = (ClientMessageInternal) message;

    if (ackIndividually) {
      individualAcknowledge(message);
    } else {
      ackBytes += message.getEncodeSize();

      if (ackBytes >= ackBatchSize) {
        doAck(cmi);
      } else {
        lastAckedMessage = cmi;
      }
    }
  }