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


Java MessageAck.setFirstMessageId方法代碼示例

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


在下文中一共展示了MessageAck.setFirstMessageId方法的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: makeAckForAllDeliveredMessages

import org.apache.activemq.command.MessageAck; //導入方法依賴的package包/類
/**
 * Creates a MessageAck for all messages contained in deliveredMessages.
 * Caller should hold the lock for deliveredMessages.
 *
 * @param type Ack-Type (i.e. MessageAck.STANDARD_ACK_TYPE)
 * @return <code>null</code> if nothing to ack.
 */
private MessageAck makeAckForAllDeliveredMessages(byte type) {
    synchronized (deliveredMessages) {
        if (deliveredMessages.isEmpty())
            return null;

        MessageDispatch md = deliveredMessages.getFirst();
        MessageAck ack = new MessageAck(md, type, deliveredMessages.size());
        ack.setFirstMessageId(deliveredMessages.getLast().getMessage().getMessageId());
        return ack;
    }
}
 
開發者ID:DiamondLightSource,項目名稱:daq-eclipse,代碼行數:19,代碼來源:ActiveMQMessageConsumer.java

示例3: doCommit

import org.apache.activemq.command.MessageAck; //導入方法依賴的package包/類
@Override
void doCommit() throws Exception {
    if (!dispatchedInTx.isEmpty()) {

        MessageDispatch md = dispatchedInTx.getFirst();
        MessageAck pendingTxAck = new MessageAck(md, MessageAck.STANDARD_ACK_TYPE, dispatchedInTx.size());
        pendingTxAck.setTransactionId(md.getMessage().getTransactionId());
        pendingTxAck.setFirstMessageId(dispatchedInTx.getLast().getMessage().getMessageId());

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

        dispatchedInTx.clear();

        sendToActiveMQ(pendingTxAck, 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();
                    }
                }
                pumpProtonToSocket();
            }
        });
    }
}
 
開發者ID:DiamondLightSource,項目名稱:daq-eclipse,代碼行數:29,代碼來源:AmqpProtocolConverter.java

示例4: 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

示例5: 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

示例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);
   info.setPoisonCause(createThrowable("PoisonCause:6"));
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:15,代碼來源: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: 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

示例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.setFirstMessageId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。