Package org.activemq.service

Examples of org.activemq.service.MessageIdentity


     * @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

        return message;
    }

    public ActiveMQMessage peekNext(MessageIdentity messageID) throws JMSException {
      ActiveMQMessage answer = null;
      MessageIdentity identity = null;
      synchronized( this ) {
            if (messageID == null) {
              identity = (MessageIdentity) messagesToBeDelivered.getFirst();
            }
            else {
View Full Code Here

     * @throws javax.jms.JMSException
     */
    public synchronized void reset() throws JMSException {
        //new Message Consumer - move all filtered/undispatched messages to front of queue
        int count = 0;
        MessageIdentity messageIdentity = (MessageIdentity) deliveredMessages.removeFirst();
        while (messageIdentity != null) {
            messagesToBeDelivered.add(count++, messageIdentity);
            messageIdentity = (MessageIdentity) deliveredMessages.removeFirst();
        }
    }
View Full Code Here

     * @param location
     */
    private void addMessage(final ActiveMQMessage message, final RecordLocation location) {
        synchronized (this) {
            lastLocation=location;
            MessageIdentity id = message.getJMSMessageIdentity();
            addedMessageIds.put(id, location);
        }
    }
View Full Code Here

     * @param location
     */
    private void removeMessage(final MessageAck ack, final RecordLocation location) {
        synchronized (this) {
            lastLocation=location;
            MessageIdentity id = ack.getMessageIdentity();
            RecordLocation msgLocation = (RecordLocation) addedMessageIds.remove(id);
            if (msgLocation == null) {
                removedMessageLocations.add(ack);
            } else {
                removedFromJournal++;
View Full Code Here

            public void execute() throws Throwable {

                // Checkpoint the added messages.
                Iterator iterator = cpAddedMessageIds.keySet().iterator();
                while (iterator.hasNext()) {
                    MessageIdentity identity = (MessageIdentity) iterator.next();
                    if( debug )
                        log.debug("Adding: "+identity.getMessageID());
                    ActiveMQMessage msg = getCacheMessage(identity);
                    // Pull it out of the journal if we have to.
                    if (msg == null) {
                        RecordLocation location = (RecordLocation) cpAddedMessageIds.get(identity);
                        msg = (ActiveMQMessage) peristenceAdapter.readPacket((RecordLocation) location);
View Full Code Here

            throw JMSExceptionHelper.newJMSException("Failed to broker message: " + messageID + " in container: " + e, e);
        } finally {
          persistenceAdapter.returnConnection(c);
        }

        MessageIdentity answer = message.getJMSMessageIdentity();
        answer.setSequenceNumber(new Long(seq));
    }
View Full Code Here

        Connection c = null;
        try {
            c = persistenceAdapter.getConnection();           
            adapter.doRecover(c, destinationName, new MessageListResultHandler() {
                public void onMessage(long seq, String messageID) throws JMSException {
                    listener.recoverMessage(new MessageIdentity(messageID, new Long(seq)));               
                }
            });    
           
        } catch (SQLException e) {
            throw JMSExceptionHelper.newJMSException("Failed to recover container. Reason: " + e, e);
View Full Code Here

    /**
     * @see org.activemq.store.TopicMessageStore#getLastestMessageIdentity()
     */
    public MessageIdentity getLastestMessageIdentity() throws JMSException {
        return new MessageIdentity(null, new Long(sequenceGenerator.getLastSequenceId()));
    }
View Full Code Here

TOP

Related Classes of org.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.