当前位置: 首页>>代码示例>>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;未经允许,请勿转载。