Package org.codehaus.activemq.service

Examples of org.codehaus.activemq.service.MessageIdentity


        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

            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 {
                    container.recoverMessageToBeDelivered(new MessageIdentity(messageID, new Long(seq)));               
                }
            });    
           
        } catch (SQLException e) {
            throw JMSExceptionHelper.newJMSException("Failed to recover container. Reason: " + e, e);
View Full Code Here

    public String getDestinationName() {
        return destinationName;
    }

    public synchronized MessageIdentity addMessage(ActiveMQMessage message) throws JMSException {
        MessageIdentity answer = messageStore.addMessage(message);
        messagesToBeDelivered.add(answer);
        return answer;

    }
View Full Code Here

    public synchronized void delete(MessageIdentity messageID, MessageAck ack) throws JMSException {
        boolean found = false;
        QueueListEntry entry = deliveredMessages.getFirstEntry();
        while (entry != null) {
            MessageIdentity identity = (MessageIdentity) entry.getElement();
            if (messageID.equals(identity)) {
                deliveredMessages.remove(entry);

                // lets used the cached identity as it has the sequence number
                // attached to it
                messageStore.removeMessage(identity, ack);
                found = true;
                break;
            }
            entry = deliveredMessages.getNextEntry(entry);
        }
        if (!found) {
            // 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);

                    // lets used the cached identity as it has the sequence number
                    // attached to it
View Full Code Here

    public void unregisterMessageInterest(MessageIdentity messageIdentity, MessageAck ack) {
    }

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

    }

    public synchronized ActiveMQMessage peekNext(MessageIdentity messageID) throws JMSException {
        ActiveMQMessage answer = null;
        if (messageID == null) {
            MessageIdentity identity = (MessageIdentity) messagesToBeDelivered.getFirst();
            if (identity != null) {
                answer = messageStore.getMessage(identity);
            }
        }
        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

    public String getDestinationName() {
        return destinationName;
    }

    public MessageIdentity addMessage(ActiveMQMessage message) throws JMSException {
        MessageIdentity answer = messageStore.addMessage(message);
        lastMessageIdentity = answer;
        return answer;
    }
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.