Package org.jboss.messaging.core

Examples of org.jboss.messaging.core.SimpleDelivery


         return null;
      }

      if (ref.getMessage().isExpired())
      {
         SimpleDelivery delivery = new SimpleDelivery(observer, ref, true);

         try
         {
            sessionEndpoint.expireDelivery(delivery, expiryQueue);
         }
         catch (Throwable t)
         {
            log.error("Failed to expire delivery: " + delivery, t);
         }

         return delivery;
      }

      synchronized (startStopLock)
      {
         // If the consumer is stopped then we don't accept the message, it should go back into the
         // queue for delivery later.
         if (!started)
         {
            if (trace) { log.trace(this + " NOT started yet!"); }

            return null;
         }
        
         if (trace) { log.trace(this + " has startStopLock lock, preparing the message for delivery"); }

         Message message = ref.getMessage();

         boolean selectorRejected = !this.accept(message);

         SimpleDelivery delivery = new SimpleDelivery(observer, ref,
                  !storeDeliveries, !selectorRejected);

         if (selectorRejected)
         {
            return delivery;
View Full Code Here


      if (trace) { log.trace(this + " handling " + reference); }

      if (filter != null && !filter.accept(reference.getMessage()))
      {
         if (trace) { log.trace(this + " rejecting " + reference + " because it doesn't match filter"); }
         return new SimpleDelivery(this, reference, false, false);
      }

      if (recoverable && reference.getMessage().isReliable())
      {
         try
         {
            // If the message is persistent and we are recoverable then we persist here, *before*
            // the message is sent across the network. This will increment any channelcount on the
            // message in storage.
            pm.addReference(channelID, reference, tx);
         }
         catch (Exception e)
         {
            log.error("Failed to add reference", e);
            return null;
         }
      }

      if (trace) { log.trace(this + " accepting " + reference + " for delivery"); }
      return new SimpleDelivery(this, reference);
   }
View Full Code Here

   {
      if (trace) { log.trace(this + " handling " + ref + " from cluster"); }

      if (filter != null && !filter.accept(ref.getMessage()))
      {
         Delivery del = new SimpleDelivery(this, ref, true, false);
        
         if (trace) { log.trace(this + " " + ref + " rejected by filter"); }
        
         return del;
      }
View Full Code Here

               {
                  ref = removeFirstInMemory();
                 
                  if (ref != null)
                  {
                     del = new SimpleDelivery(LocalClusteredQueue.this, ref);
                    
                     deliveringCount.increment();
                  }                                       
               }                   
            }
View Full Code Here

                  ref.releaseMemoryReference();
               }
            }
                      
            //Acknowledge on the remote queue stub
            Delivery del = new SimpleDelivery(remoteQueue, ref);
           
            del.acknowledge(tx);       
                       
            //For testing to simulate failures
            if (failBeforeCommit)
            {
               throw new Exception("Test failure before commit");
View Full Code Here

   public void setUp() throws Exception
   {
      super.setUp();

      observer = new SimpleDeliveryObserver();
      delivery = new SimpleDelivery(observer, null, false);

      log.debug("setup done");
   }
View Full Code Here

         }
        
         if (SELECTOR_REJECTING.equals(state))
         {
            log.trace(this + " is rejecting message since doesn't match selector");
            return new SimpleDelivery(null, null, true, false);
         }

         if (REJECTING.equals(state))
         {

            log.trace(this + " is rejecting reference " + ref);
            return null;
         }
        
         if (ACCEPTING_TO_MAX.equals(state))
         {
            //Only accept up to maxRefs references
            if (messages.size() == maxRefs)
            {
               return null;
            }
         }

         if (BROKEN.equals(state))
         {
            throw new RuntimeException("THIS IS AN EXCEPTION THAT SIMULATES "+
                                       "THE BEHAVIOUR OF A BROKEN RECEIVER");
         }

         log.trace("State is:" + state);
        
         boolean done = ACKING.equals(state);
        
         //NOTE! it is NOT Nacking, it is keeping - don't say NACKing - it is misleading (nack means cancel)        
         log.trace(this + " is " + (done ? "ACKing" : "Keeping") " message " + ref);
        
         Message m = ref.getMessage();
        
         SimpleDelivery delivery = new SimpleDelivery(observer, ref, done);
         messages.add(new Object[] {m, done ? null : delivery});
        
         if (immediateAsynchronousAcknowledgment)
         {
            log.trace("simulating an asynchronous ACK that arrives before we return the delivery to channel");
            try
            {
               delivery.acknowledge(null);
            }
            catch(Throwable t)
            {
               log.error("Cannot acknowledge", t);
            }
View Full Code Here

      {
         throw new RuntimeException("I AM BROKEN!");
      }

      refs.add(ref);
      return new SimpleDelivery(observer, ref, true);
   }
View Full Code Here

            Queue queue = binding.getQueue();
  
            if (trace) log.trace("Destination for message[ID=" + ref.getMessage().getMessageID() + "] is: " + queue);
  
            //Create a new delivery - note that it must have a delivery observer otherwise acknowledge will fail
            Delivery del = new SimpleDelivery(queue, ref);

            if (trace) log.trace("Acknowledging..");

            try
            {
               del.acknowledge(tx);
            }
            catch (Throwable t)
            {
               log.error("Failed to acknowledge " + del + " during recovery", t);
            }
View Full Code Here

         }
      }

      if (del == null && selectorRejected)
      {
         del = new SimpleDelivery(null, null, true, false);
      }

      return del;     
   }
View Full Code Here

TOP

Related Classes of org.jboss.messaging.core.SimpleDelivery

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.