Package net.timewalker.ffmq3.common.message

Examples of net.timewalker.ffmq3.common.message.AbstractMessage


      throw new NoSuchElementException();
   
    try
    {
      checkNotClosed();
      AbstractMessage msg = fetchNext();
      if (msg != null)
      {
        nextMessage = null; // Consume fetched message
        AbstractMessage msgCopy = MessageTools.duplicate(msg);
        msgCopy.ensureDeserializationLevel(MessageSerializationLevel.FULL);
        return msgCopy;
      }
     
      throw new NoSuchElementException();
    }
View Full Code Here


             
              MessageStore store = transactionItem.getDeliveryMode() == DeliveryMode.PERSISTENT ? persistentStore : volatileStore;
              int handle = transactionItem.getHandle();
             
              // Retrieve message content
               AbstractMessage msg = store.retrieve(handle);
              
               // Update redelivered flag both in memory and message store
               msg.setJMSRedelivered(true);
               handle = store.replace(handle, msg);
              
              if (redeliveryDelay > 0)
              {
                  // Keep the message locked so it cannot be re-consumed immediately                 
View Full Code Here

      if (closed)
        return null;
     
      this.lastActivity = System.currentTimeMillis();
     
      AbstractMessage msg = null;
     
        // Search in volatile store first
        if (volatileStore != null)
        {
            msg = getFromStore(localSession, volatileStore, transactionSet, selector);
View Full Code Here

      cursor.reset();
     
      // Search in volatile store first
        if (volatileStore != null)
        {
            AbstractMessage msg = browseStore(volatileStore, cursor, selector);
            if (msg != null)
            {
              cursor.move();
                return msg;
            }
        }
       
        // Then in persistent store
        if (persistentStore != null)
        {
          AbstractMessage msg = browseStore(persistentStore, cursor, selector);
          if (msg != null)
            {
              cursor.move();
                return msg;
            }
View Full Code Here

            {
                // Skip locked messages
                if (!store.isLocked(current))
                {
                    // Retrieve the message
                    AbstractMessage msg = store.retrieve(current);
                   
                    // Check expiration
                    if (msg.getJMSExpiration() > 0 && msg.getJMSExpiration() < now)
                    {
                      int handleToDelete = current;
                      current = store.next(current);
                      store.delete(handleToDelete);
                      continue;
                    }
                   
                    // Check selector
                    if (selector == null)
                    {
                        return msg;
                    }
                    else
                    {
                      msg.ensureDeserializationLevel(MessageSerializationLevel.ALL_HEADERS);
                      if (selector.matches(msg))
                        return msg;
                    }
                }
               
View Full Code Here

            {
                // Skip locked messages
                if (!store.isLocked(current))
                {
                    // Retrieve the message
                    AbstractMessage msg = store.retrieve(current);
  
                    // Check expiration
                    if (msg.getJMSExpiration() > 0 && msg.getJMSExpiration() < lastActivity)
                    {
                      int handleToDelete = current;
                      current = store.next(current);
                      store.delete(handleToDelete);
                      continue;
                    }
                   
                    // Check selector
                    boolean matchesSelector;
                    if (selector != null)
                    {
                      msg.ensureDeserializationLevel(MessageSerializationLevel.ALL_HEADERS);
                      matchesSelector = selector.matches(msg);
                    }
                    else
                      matchesSelector = true;
                   
                    if (matchesSelector)
                    {
                        store.lock(current);
                       
                        if (traceEnabled)
                          log.trace(localSession+" LOCKED "+msg.getJMSMessageID());
                       
                        transactionSet.add(current,
                                       msg.getJMSMessageID(),
                                       store.getDeliveryMode(),
                                       this);
                        receivedFromQueueCount++;
                        return msg;
                    }
View Full Code Here

                // Skip locked messages
                if (!store.isLocked(current))
                {
                  if (selector != null)
                  {
                    AbstractMessage msg = store.retrieve(current);
                    msg.ensureDeserializationLevel(MessageSerializationLevel.ALL_HEADERS);
                        if (selector.matches(msg))
                          store.delete(current);
                  }
                  else
                    store.delete(current);
View Full Code Here

                    log.debug(this+" - COMMIT [PUT:QUEUE] "+pendingQueuePuts.size()+" message(s)");
               
              // Simpler (and most common) use case
              if (pendingQueuePuts.size() == -1)
              {
                AbstractMessage message = (AbstractMessage)pendingQueuePuts.get(0);
                putImmediately(message,committables);               
                producedCount++;
              }
              else
              {
                // A two phase injection is required because one destination may throw
                // an exception while messages have already been added to queues (queue full for example)
               
                // Step 1 - Put messages in locked state
                MessageLockSet locks = new MessageLockSet(pendingQueuePuts.size());
                try
                {
                  for (int i = 0; i < pendingQueuePuts.size(); i++)
                  {
                    AbstractMessage message = (AbstractMessage)pendingQueuePuts.get(i);
                    putLocked(message, locks, committables);
                    producedCount++;
                }
                }
                catch (JMSException e)
                {
                  // Remove locked messages
                  for (int i = 0; i < locks.size(); i++)
              {
                MessageLock item = locks.get(i);
                item.getDestination().removeLocked(item);
              }
                 
                  throw e;
                }
               
                // Step 2 - Unlock & deliver messages
                for (int i = 0; i < locks.size(); i++)
            {
              MessageLock item = locks.get(i);
              item.getDestination().unlockAndDeliver(item);
            }
              }
             
              pendingQueuePuts.clear();
            }
        }
       
        // Topic messages
        synchronized (pendingTopicPuts)
        {
            if (!pendingTopicPuts.isEmpty())
            {
              if (debugEnabled)
                    log.debug(this+" - COMMIT [PUT:TOPIC] "+pendingTopicPuts.size()+" message(s)");
               
              for (int i = 0; i < pendingTopicPuts.size(); i++)
          {
                AbstractMessage message = (AbstractMessage)pendingTopicPuts.get(i);
                  putImmediately(message,committables);               
                  producedCount++; 
          }
             
              pendingTopicPuts.clear();
View Full Code Here

        super(session,destination,messageSelector,noLocal,consumerId);
        this.engine = engine;
        this.session = session;
        this.parsedSelector =
            StringTools.isNotEmpty(messageSelector) ?
                new MessageSelector(messageSelector) : null;
        this.traceEnabled = log.isTraceEnabled();
        this.transactionSet = session.getTransactionSet();
        this.notificationProxy = session.getNotificationProxy();
        this.prefetchCapacity = this.prefetchSize = engine.getSetup().getConsumerPrefetchSize();
        this.logListenersFailures = getSettings().getBooleanProperty(FFMQCoreSettings.DELIVERY_LOG_LISTENERS_FAILURES, false);
View Full Code Here

          throw new FFMQException("Consumer should not be accessed by more than one thread","ILLEGAL_USAGE");
       
        receiving = true;
        try
        {
          MessageSelector selector = getReceiveSelector();
         
          // No-wait simplified case
          if (timeout == 0)
          {
            if (!connection.isStarted())
View Full Code Here

TOP

Related Classes of net.timewalker.ffmq3.common.message.AbstractMessage

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.