Package org.apache.activemq.command

Examples of org.apache.activemq.command.MessageAck


        synchronized (this) {
            lastLocation = location;
        }
        if (topicReferenceStore.acknowledgeReference(context, clientId,
                subscriptionName, messageId)) {
            MessageAck ack = new MessageAck();
            ack.setLastMessageId(messageId);
            removeMessage(context, ack);

        }
        try {
            asyncWriteTask.wakeup();
View Full Code Here


                // Checkpoint the removed messages.
                Iterator<MessageAck> iterator = cpRemovedMessageLocations.iterator();
                while (iterator.hasNext()) {
                    try {
                        MessageAck ack = iterator.next();
                        longTermStore.removeMessage(transactionTemplate.getContext(), ack);
                    } catch (Throwable e) {
                        LOG.debug("Message could not be removed from long term store: " + e.getMessage(), e);
                    }
                }
View Full Code Here

            }
            return rc;
        }

        public MessageAck[] getAcks() {
            MessageAck rc[] = new MessageAck[acks.size()];
            int count = 0;
            for (Iterator<RemoveMessageCommand> iter = acks.iterator(); iter.hasNext();) {
                RemoveMessageCommand cmd = iter.next();
                rc[count++] = cmd.getMessageAck();
            }
View Full Code Here

    public void close() throws IOException {
        if (!unconsumedMessages.isClosed()) {
            try {
                if (lastDelivered != null) {
                    MessageAck ack = new MessageAck(lastDelivered, MessageAck.STANDARD_ACK_TYPE, deliveredCounter);
                    connection.asyncSendPacket(ack);
                }
                dispose();
                this.connection.syncSendPacket(info.createRemoveCommand());
            } catch (JMSException e) {
View Full Code Here

            return null;
        }

        deliveredCounter++;
        if ((0.75 * info.getPrefetchSize()) <= deliveredCounter) {
            MessageAck ack = new MessageAck(md, MessageAck.STANDARD_ACK_TYPE, deliveredCounter);
            connection.asyncSendPacket(ack);
            deliveredCounter = 0;
            lastDelivered = null;
        } else {
            lastDelivered = md;
View Full Code Here

        // Auto ack messages when we reach 75% of the prefetch
        deliveredCounter++;
        if (deliveredCounter > (0.75 * info.getPrefetchSize())) {
            try {
                MessageAck ack = new MessageAck(md, MessageAck.STANDARD_ACK_TYPE, deliveredCounter);
                connection.asyncSendPacket(ack);
                deliveredCounter = 0;
            } catch (JMSException e) {
                connection.onAsyncException(e);
            }
View Full Code Here

        if (ackMode == CLIENT_ACK) {
            synchronized (this) {
                dispatchedMessage.put(message.getJMSMessageID(), message.getMessageId());
            }
        } else if (ackMode == AUTO_ACK) {
            MessageAck ack = new MessageAck(md, MessageAck.STANDARD_ACK_TYPE, 1);
            protocolConverter.getTransportFilter().sendToActiveMQ(ack);
        }

        StompFrame command = protocolConverter.convertMessage(message);
View Full Code Here

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

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

        int count = 0;
        for (Iterator iter = dispatchedMessage.entrySet().iterator(); iter.hasNext();) {

            Map.Entry entry = (Entry)iter.next();
            String id = (String)entry.getKey();
            MessageId msgid = (MessageId)entry.getValue();

            if (ack.getFirstMessageId() == null) {
                ack.setFirstMessageId(msgid);
            }

            iter.remove();
            count++;

            if (id.equals(messageId)) {
                ack.setLastMessageId(msgid);
                break;
            }

        }

        ack.setMessageCount(count);
        return ack;
    }
View Full Code Here

        }

        boolean acked = false;
        for (Iterator<StompSubscription> iter = subscriptionsByConsumerId.values().iterator(); iter.hasNext();) {
            StompSubscription sub = iter.next();
            MessageAck ack = sub.onStompMessageAck(messageId);
            if (ack != null) {
                ack.setTransactionId(activemqTx);
                sendToActiveMQ(ack, createResponseHandler(command));
                acked = true;
                break;
            }
        }
View Full Code Here

    @Override
    public void close() throws IOException {
        if (!unconsumedMessages.isClosed()) {
            try {
                if (lastDelivered != null) {
                    MessageAck ack = new MessageAck(lastDelivered, MessageAck.STANDARD_ACK_TYPE, deliveredCounter);
                    connection.asyncSendPacket(ack);
                }
                dispose();
                this.connection.syncSendPacket(info.createRemoveCommand());
            } catch (JMSException e) {
View Full Code Here

TOP

Related Classes of org.apache.activemq.command.MessageAck

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.