當前位置: 首頁>>代碼示例>>Java>>正文


Java MessageAck.setMessageCount方法代碼示例

本文整理匯總了Java中org.apache.activemq.command.MessageAck.setMessageCount方法的典型用法代碼示例。如果您正苦於以下問題:Java MessageAck.setMessageCount方法的具體用法?Java MessageAck.setMessageCount怎麽用?Java MessageAck.setMessageCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.activemq.command.MessageAck的用法示例。


在下文中一共展示了MessageAck.setMessageCount方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: convertToNonRangedAck

import org.apache.activemq.command.MessageAck; //導入方法依賴的package包/類
protected MessageAck convertToNonRangedAck(MessageAck ack, MessageReference node) {
    // the original ack may be a ranged ack, but we are trying to delete
    // a specific
    // message store here so we need to convert to a non ranged ack.
    if (ack.getMessageCount() > 0) {
        // Dup the ack
        MessageAck a = new MessageAck();
        ack.copy(a);
        ack = a;
        // Convert to non-ranged.
        ack.setFirstMessageId(node.getMessageId());
        ack.setLastMessageId(node.getMessageId());
        ack.setMessageCount(1);
    }
    return ack;
}
 
開發者ID:DiamondLightSource,項目名稱:daq-eclipse,代碼行數:17,代碼來源:BaseDestination.java

示例2: tightUnmarshal

import org.apache.activemq.command.MessageAck; //導入方法依賴的package包/類
/**
 * Un-marshal an object instance from the data input stream
 *
 * @param o the object to un-marshal
 * @param dataIn the data input stream to build the object from
 * @throws IOException
 */
public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
    super.tightUnmarshal(wireFormat, o, dataIn, bs);

    MessageAck info = (MessageAck)o;
    info.setDestination((org.apache.activemq.command.ActiveMQDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
    info.setTransactionId((org.apache.activemq.command.TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
    info.setConsumerId((org.apache.activemq.command.ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
    info.setAckType(dataIn.readByte());
    info.setFirstMessageId((org.apache.activemq.command.MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
    info.setLastMessageId((org.apache.activemq.command.MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
    info.setMessageCount(dataIn.readInt());

}
 
開發者ID:DiamondLightSource,項目名稱:daq-eclipse,代碼行數:21,代碼來源:MessageAckMarshaller.java

示例3: looseUnmarshal

import org.apache.activemq.command.MessageAck; //導入方法依賴的package包/類
/**
 * Un-marshal an object instance from the data input stream
 *
 * @param o the object to un-marshal
 * @param dataIn the data input stream to build the object from
 * @throws IOException
 */
public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
    super.looseUnmarshal(wireFormat, o, dataIn);

    MessageAck info = (MessageAck)o;
    info.setDestination((org.apache.activemq.command.ActiveMQDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
    info.setTransactionId((org.apache.activemq.command.TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
    info.setConsumerId((org.apache.activemq.command.ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
    info.setAckType(dataIn.readByte());
    info.setFirstMessageId((org.apache.activemq.command.MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
    info.setLastMessageId((org.apache.activemq.command.MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
    info.setMessageCount(dataIn.readInt());

}
 
開發者ID:DiamondLightSource,項目名稱:daq-eclipse,代碼行數:21,代碼來源:MessageAckMarshaller.java

示例4: createAck

import org.apache.activemq.command.MessageAck; //導入方法依賴的package包/類
protected MessageAck createAck(ConsumerInfo consumerInfo, Message msg, int count, byte ackType) {
   MessageAck ack = new MessageAck();
   ack.setAckType(ackType);
   ack.setConsumerId(consumerInfo.getConsumerId());
   ack.setDestination(msg.getDestination());
   ack.setLastMessageId(msg.getMessageId());
   ack.setMessageCount(count);
   return ack;
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:10,代碼來源:ClientTestSupport.java

示例5: populateObject

import org.apache.activemq.command.MessageAck; //導入方法依賴的package包/類
@Override
protected void populateObject(Object object) throws Exception {
   super.populateObject(object);
   MessageAck info = (MessageAck) object;

   info.setDestination(createActiveMQDestination("Destination:1"));
   info.setTransactionId(createTransactionId("TransactionId:2"));
   info.setConsumerId(createConsumerId("ConsumerId:3"));
   info.setAckType((byte) 1);
   info.setFirstMessageId(createMessageId("FirstMessageId:4"));
   info.setLastMessageId(createMessageId("LastMessageId:5"));
   info.setMessageCount(1);
   info.setPoisonCause(createThrowable("PoisonCause:6"));
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:15,代碼來源:MessageAckTest.java

示例6: populateObject

import org.apache.activemq.command.MessageAck; //導入方法依賴的package包/類
@Override
protected void populateObject(Object object) throws Exception {
   super.populateObject(object);
   MessageAck info = (MessageAck) object;
   info.setDestination(createActiveMQDestination("Destination:1"));
   info.setTransactionId(createTransactionId("TransactionId:2"));
   info.setConsumerId(createConsumerId("ConsumerId:3"));
   info.setAckType((byte) 1);
   info.setFirstMessageId(createMessageId("FirstMessageId:4"));
   info.setLastMessageId(createMessageId("LastMessageId:5"));
   info.setMessageCount(1);

}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:14,代碼來源:MessageAckTest.java

示例7: populateObject

import org.apache.activemq.command.MessageAck; //導入方法依賴的package包/類
@Override
protected void populateObject(Object object) throws Exception {
   super.populateObject(object);
   MessageAck info = (MessageAck) object;

   info.setDestination(createActiveMQDestination("Destination:1"));
   info.setTransactionId(createTransactionId("TransactionId:2"));
   info.setConsumerId(createConsumerId("ConsumerId:3"));
   info.setAckType((byte) 1);
   info.setFirstMessageId(createMessageId("FirstMessageId:4"));
   info.setLastMessageId(createMessageId("LastMessageId:5"));
   info.setMessageCount(1);
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:14,代碼來源:MessageAckTest.java

示例8: onStompMessageAck

import org.apache.activemq.command.MessageAck; //導入方法依賴的package包/類
synchronized MessageAck onStompMessageAck(String messageId, TransactionId transactionId) {

        MessageId msgId = new MessageId(messageId);

        if (!dispatchedMessage.containsKey(msgId)) {
            return null;
        }

        MessageAck ack = new MessageAck();
        ack.setDestination(consumerInfo.getDestination());
        ack.setConsumerId(consumerInfo.getConsumerId());

        if (ackMode == CLIENT_ACK) {
            if (transactionId == null) {
                ack.setAckType(MessageAck.STANDARD_ACK_TYPE);
            } else {
                ack.setAckType(MessageAck.DELIVERED_ACK_TYPE);
            }
            int count = 0;
            for (Iterator<?> iter = dispatchedMessage.entrySet().iterator(); iter.hasNext();) {

                @SuppressWarnings("rawtypes")
                Map.Entry entry = (Entry)iter.next();
                MessageId id = (MessageId)entry.getKey();
                MessageDispatch msg = (MessageDispatch)entry.getValue();

                if (transactionId != null) {
                    if (!unconsumedMessage.contains(msg)) {
                        unconsumedMessage.add(msg);
                        count++;
                    }
                } else {
                    iter.remove();
                    count++;
                }

                if (id.equals(msgId)) {
                    ack.setLastMessageId(id);
                    break;
                }
            }
            ack.setMessageCount(count);
            if (transactionId != null) {
                ack.setTransactionId(transactionId);
            }

        } else if (ackMode == INDIVIDUAL_ACK) {
            ack.setAckType(MessageAck.INDIVIDUAL_ACK_TYPE);
            ack.setMessageID(msgId);
            if (transactionId != null) {
                unconsumedMessage.add(dispatchedMessage.get(msgId));
                ack.setTransactionId(transactionId);
            }
            dispatchedMessage.remove(msgId);
        }
        return ack;
    }
 
開發者ID:DiamondLightSource,項目名稱:daq-eclipse,代碼行數:58,代碼來源:StompSubscription.java

示例9: settle

import org.apache.activemq.command.MessageAck; //導入方法依賴的package包/類
private void settle(final Delivery delivery, final int ackType) throws Exception {
    byte[] tag = delivery.getTag();
    if (tag != null && tag.length > 0 && delivery.remotelySettled()) {
        checkinTag(tag);
    }

    if (ackType == -1) {
        // we are going to settle, but redeliver.. we we won't yet ack to ActiveMQ
        delivery.settle();
        onMessageDispatch((MessageDispatch) delivery.getContext());
    } else {
        MessageDispatch md = (MessageDispatch) delivery.getContext();
        MessageAck ack = new MessageAck();
        ack.setConsumerId(consumerId);
        ack.setFirstMessageId(md.getMessage().getMessageId());
        ack.setLastMessageId(md.getMessage().getMessageId());
        ack.setMessageCount(1);
        ack.setAckType((byte) ackType);
        ack.setDestination(md.getDestination());

        DeliveryState remoteState = delivery.getRemoteState();
        if (remoteState != null && remoteState instanceof TransactionalState) {
            TransactionalState s = (TransactionalState) remoteState;
            long txid = toLong(s.getTxnId());
            LocalTransactionId localTxId = new LocalTransactionId(connectionId, txid);
            ack.setTransactionId(localTxId);

            // Store the message sent in this TX we might need to re-send on rollback
            md.getMessage().setTransactionId(localTxId);
            dispatchedInTx.addFirst(md);
        }

        LOG.trace("Sending Ack to ActiveMQ: {}", ack);

        sendToActiveMQ(ack, new ResponseHandler() {
            @Override
            public void onResponse(IAmqpProtocolConverter converter, Response response) throws IOException {
                if (response.isException()) {
                    if (response.isException()) {
                        Throwable exception = ((ExceptionResponse) response).getException();
                        exception.printStackTrace();
                        sender.close();
                    }
                } else {
                    delivery.settle();
                }
                pumpProtonToSocket();
            }
        });
    }
}
 
開發者ID:DiamondLightSource,項目名稱:daq-eclipse,代碼行數:52,代碼來源:AmqpProtocolConverter.java


注:本文中的org.apache.activemq.command.MessageAck.setMessageCount方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。