Examples of MessageAck


Examples of org.apache.activemq.command.MessageAck

                            // If the message was originally sent using async
                            // send, we will preserve that QOS
                            // by bridging it using an async send (small chance
                            // of message loss).
                            remoteBroker.oneway(message);
                            localBroker.oneway(new MessageAck(md, MessageAck.STANDARD_ACK_TYPE, 1));
                            dequeueCounter.incrementAndGet();

                        } else {

                            // The message was not sent using async send, so we
                            // should only ack the local
                            // broker when we get confirmation that the remote
                            // broker has received the message.
                            ResponseCallback callback = new ResponseCallback() {
                                public void onCompletion(FutureResponse future) {
                                    try {
                                        Response response = future.getResult();
                                        if (response.isException()) {
                                            ExceptionResponse er = (ExceptionResponse)response;
                                            serviceLocalException(er.getException());
                                        } else {
                                            localBroker.oneway(new MessageAck(md, MessageAck.STANDARD_ACK_TYPE, 1));
                                            dequeueCounter.incrementAndGet();
                                        }
                                    } catch (IOException e) {
                                        serviceLocalException(e);
                                    }
View Full Code Here

Examples of org.apache.activemq.command.MessageAck

            // 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());
View Full Code Here

Examples of org.apache.activemq.command.MessageAck

                try {
                    QueueMessageReference r = (QueueMessageReference)i.next();

                    // We should only delete messages that can be locked.
                    if (r.lock(LockOwner.HIGH_PRIORITY_LOCK_OWNER)) {
                        MessageAck ack = new MessageAck();
                        ack.setAckType(MessageAck.STANDARD_ACK_TYPE);
                        ack.setDestination(destination);
                        ack.setMessageID(r.getMessageId());
                        acknowledge(c, null, ack, r);
                        r.drop();
                        dropEvent(true);
                    }
                } catch (IOException e) {
View Full Code Here

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

Examples of org.apache.activemq.command.MessageAck

                // 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

Examples of org.apache.activemq.command.MessageAck

            }
            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

Examples of org.apache.activemq.command.MessageAck

    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

Examples of org.apache.activemq.command.MessageAck

            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

Examples of org.apache.activemq.command.MessageAck

        // 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

Examples of org.apache.activemq.command.MessageAck

        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
TOP
Copyright © 2018 www.massapi.com. 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.