Package org.codehaus.activemq.message

Examples of org.codehaus.activemq.message.ActiveMQMessage


                        packet = wireFormat.readPacket(is);

                        // Try to replay the packet.
                        JournalMessageStore store = (JournalMessageStore) createQueueMessageStore(destination);
                        if (packet instanceof ActiveMQMessage) {
                            ActiveMQMessage msg = (ActiveMQMessage) packet;
                            try {
                                store.getLongTermStore().addMessage(msg);
                                transactionCounter++;
                            }
                            catch (Throwable e) {
                                log.error("Recovery Failure: Could not add message: " + msg.getJMSMessageIdentity().getMessageID() + ", reason: " + e, e);
                            }
                        }
                        else if (packet instanceof MessageAck) {
                            MessageAck ack = (MessageAck) packet;
                            try {
View Full Code Here


  /**
   * Return the message from the cache or go to the longTermStore if it is not
   * in there.
   */
  public ActiveMQMessage getMessage(MessageIdentity identitythrows JMSException {
    ActiveMQMessage answer=null;
    answer = cache.get(identity.getMessageID());
    if( answer!=null )
      return answer;
   
    answer = longTermStore.getMessage(identity);
View Full Code Here

     *
     * @param id
     * @return the removed ActiveMQMessage with the associated id
     */
    public ActiveMQMessage acknowledgeMessage(String id) {
        ActiveMQMessage msg = (ActiveMQMessage) dispatchedQueue.remove(id);
        return msg;
    }
View Full Code Here

        // Checkpoint the added messages.
        Iterator iterator = addedMessageIdentitys.iterator();
        while (iterator.hasNext()) {         
          MessageIdentity identity = (MessageIdentity) iterator.next();
         
          ActiveMQMessage msg = getCacheMessage(identity);
          longTermStore.addMessage(msg);
          synchronized(this) {
            RecordLocation location = (RecordLocation)addedMessageLocations.remove(identity);
            if( rc[0]==null || rc[0].compareTo(location)<0 ) {
              rc[0] = location;
View Full Code Here

  /**
   *
   */
  public ActiveMQMessage getMessage(MessageIdentity identitythrows JMSException {
    ActiveMQMessage answer=null;
   
    Object location = identity.getSequenceNumber();
    if( location==null ) {
      // The sequence number may not have been set but it may still be in the journal.
      synchronized(this) {
View Full Code Here

        List tmpList = new ArrayList();
        QueueListEntry entry = messagePtrs.getFirstEntry();
        while (entry != null) {
            MessagePointer pointer = (MessagePointer) entry.getElement();
            if (!pointer.isDispatched()) {
                ActiveMQMessage msg = pointer.getContainer().getMessage(pointer.getMessageIdentity());
                if (msg != null) {
                    if (pointer.isDispatched() || pointer.isRedelivered()) {
                        //already dispatched - so mark as redelivered
                        msg.setJMSRedelivered(true);
                    }
                    pointer.setDispatched(true);
                    tmpList.add(msg);
                }
                else {
View Full Code Here

        int count = 0;
        int maxNumberToDispatch = prefetchLimit - unconsumedMessagesDispatched.get();
        while (entry != null && count < maxNumberToDispatch) {
            MessagePointer pointer = (MessagePointer) entry.getElement();
            if (!pointer.isDispatched()) {
                ActiveMQMessage msg = pointer.getContainer().getMessage(pointer.getMessageIdentity());
                if (msg != null) {
                    if (pointer.isDispatched() || pointer.isRedelivered()) {
                        //already dispatched - so mark as redelivered
                        msg.setJMSRedelivered(true);
                    }
                    pointer.setDispatched(true);
                    tmpList.add(msg);
                    unconsumedMessagesDispatched.increment();
                    count++;
View Full Code Here

    /**
     * Lets ensure that readers don't block writers so there only synchronization on
     * the cache and checkpointStore.
     */
    public ActiveMQMessage getMessage(MessageIdentity identity) throws JMSException {
        ActiveMQMessage answer = null;
        synchronized (map) {
            answer = (ActiveMQMessage) map.get(identity.getMessageID());
        }
        if (answer == null) {
            answer = longTermStore.getMessage(identity);
View Full Code Here

    /**
     * do some dispatching
     */
    public void run() {
        int count = 0;
        ActiveMQMessage message = null;
        while (started.get()) {
            try {
                message = (ActiveMQMessage) queue.dequeue(2000);
                if (message != null && !message.isExpired()) {
                    client.dispatch(message);
                    if (++count == 250) {
                        count = 0;
                        Thread.yield();
                    }
View Full Code Here

        messageTable.remove(msgId.getMessageID());
    }

    public void recover(QueueMessageContainer container) throws JMSException {
        for (Iterator iter = messageTable.values().iterator(); iter.hasNext();) {
            ActiveMQMessage msg = (ActiveMQMessage) iter.next();
            container.recoverMessageToBeDelivered(msg.getJMSMessageIdentity());
        }
    }
View Full Code Here

TOP

Related Classes of org.codehaus.activemq.message.ActiveMQMessage

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.