Package org.codehaus.activemq.service

Examples of org.codehaus.activemq.service.MessageIdentity


        try {
            Tuple tuple = new Tuple();
            TupleBrowser iter = getOrderedIndex().browse();
            while (iter.getNext(tuple)) {               
                Object sequenceID = tuple.getKey();
                MessageIdentity messageIdentity = null;
                if (sequenceID != null) {
                    String messageID = (String) tuple.getValue();
                    if (messageID != null) {
                        getMessageTable().remove(messageID);
                    }
View Full Code Here


       
        // Checkpoint the acked messages.
        Iterator iterator = ackedLastAckLocations.keySet().iterator();
        while (iterator.hasNext()) {         
            String subscription = (String) iterator.next();
            MessageIdentity identity = (MessageIdentity) ackedLastAckLocations.get(subscription);           
          longTermStore.setLastAcknowledgedMessageIdentity(subscription, identity);
        }       
       
      }
View Full Code Here

                        String subscription = is.readUTF();
                        String messageId = is.readUTF();
                       
                        JournalTopicMessageStore store = (JournalTopicMessageStore) createMessageStore(destination, false);
                        try {                           
                            store.getLongTermTopicMessageStore().setLastAcknowledgedMessageIdentity(subscription, new MessageIdentity(messageId));
                        }
                        catch (Throwable e) {
                            log.error("Recovery Failure: Could not ack message: " + messageId + ", reason: " + e, e);
                        }
                       
View Full Code Here

        }
    }

    public synchronized void recoverSubscription(Subscription subscription, MessageIdentity lastDispatchedMessage) throws JMSException {
        try {
            MessageIdentity lastAcked = getLastAcknowledgedMessageIdentity(subscription);
            if (lastAcked == null) {
                // for a new durable subscription lets write the last ack messageID
                // as the previous one that the container delivered to ensure that
                // if we go down before acking anything, we will recover to the right point
                setLastAcknowledgedMessageIdentity(subscription.getPersistentKey(), lastDispatchedMessage);
                return;
            }
            Object lastAckedSequenceNumber = lastAcked.getSequenceNumber();

            // lets iterate through all IDs from the

            //Tuple tuple = new Tuple();
            Tuple tuple = getOrderedIndex().findGreaterOrEqual(lastAckedSequenceNumber);
View Full Code Here

            throw JMSExceptionHelper.newJMSException("Failed to recover subscription: " + subscription + ". Reason: " + e, e);
        }
    }

    public synchronized MessageIdentity getLastestMessageIdentity() throws JMSException {
        return new MessageIdentity(null, new Long(getLastSequenceNumber()));
    }
View Full Code Here

        transactionTemplate.run(new Callback() {
            public void execute() throws Throwable {
                writeMessage(0);

                // lets delete using a String which should cause a warning
                MessageIdentity messageIdentity = new MessageIdentity(messageIds[0]);
                container.delete(messageIdentity, createMessageAck(messageIdentity));
            }
        });

        System.out.println("About to write: " + messageCount + " messages to the container: " + container);
View Full Code Here

        return xaTransacted;
    }

    public MessageIdentity getMessageIdentity() {
        if (messageIdentity == null) {
            messageIdentity = new MessageIdentity(getMessageID());
        }
        return messageIdentity;
    }
View Full Code Here

        return destinationName;
    }

    public void addMessage(ActiveMQMessage message) throws JMSException {
        messageStore.addMessage(message);
        final MessageIdentity answer = message.getJMSMessageIdentity();
       
        // If there is no transaction.. then this executes directly.
        TransactionManager.getContexTransaction().addPostCommitTask(new TransactionTask(){
            public void execute() throws Throwable {
                synchronized( this ) {
View Full Code Here

     * @param messageID
     * @param storedIdentity
     * @throws JMSException
     */
    private void doDelete(MessageIdentity messageID) throws JMSException {
        MessageIdentity storedIdentity=null;
        synchronized( this ) {
          QueueListEntry entry = deliveredMessages.getFirstEntry();
          while (entry != null) {
              MessageIdentity identity = (MessageIdentity) entry.getElement();
              if (messageID.equals(identity)) {
                  deliveredMessages.remove(entry);
                  storedIdentity=identity;
                  break;
              }
              entry = deliveredMessages.getNextEntry(entry);
          }
         
          if (storedIdentity==null) {
              // maybe the messages have not been delivered yet
              // as we are recovering from a previous transaction log
              entry = messagesToBeDelivered.getFirstEntry();
              while (entry != null) {
                  MessageIdentity identity = (MessageIdentity) entry.getElement();
                  if (messageID.equals(identity)) {                     
                        messagesToBeDelivered.remove(entry);
                      storedIdentity=identity;
                      break;
                  }
View Full Code Here

    public void unregisterMessageInterest(MessageIdentity ack) {
    }

    public ActiveMQMessage poll() throws JMSException {
        ActiveMQMessage message = null;
        MessageIdentity messageIdentity=null;
      synchronized( this ) {
          messageIdentity = (MessageIdentity) messagesToBeDelivered.removeFirst();
          if (messageIdentity != null) {
              deliveredMessages.add(messageIdentity);
          }
View Full Code Here

TOP

Related Classes of org.codehaus.activemq.service.MessageIdentity

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.