Package org.jboss.messaging.core.impl

Examples of org.jboss.messaging.core.impl.SimpleDelivery


                    
                     ReferenceInfo mInfo = refInfoMap.get(m.getMessageID());
                     mref.setDeliveryCount(mInfo.getDeliveryCount());
                     mref.setScheduledDeliveryTime(mInfo.getScheduledDelivery());
                    
                     Delivery del = new SimpleDelivery(ch, mref, true, true);
                     del.cancel();
                  }
                  channels.add(ch);
               }
            }
         }
View Full Code Here


         return null;
      }

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

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

         return delivery;
      }
     
      if (preserveOrdering && remote)
      {
        //If the header exists it means the message has already been sucked once - so reject.
       
        if (ref.getMessage().getHeader(Message.CLUSTER_SUCKED) != null)
        {
          if (trace) { log.trace("Message has already been sucked once - not sucking again"); }
         
          return null;
        }           
      }

      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!"); }

            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, !selectorRejected, false);

         if (selectorRejected)
         {
            return delivery;
         }
        
         if (noLocal)
         {
            String conId = ((JBossMessage) message).getConnectionID();

            if (trace) { log.trace("message connection id: " + conId + " current connection connection id: " + sessionEndpoint.getConnectionEndpoint().getConnectionID()); }

            if (sessionEndpoint.getConnectionEndpoint().getConnectionID().equals(conId))
            {
              if (trace) { log.trace("Message from local connection so rejecting"); }
             
              try
               {
                 delivery.acknowledge(null);
               }
               catch (Throwable t)
               {
                 log.error("Failed to acknowledge delivery", t);
                
View Full Code Here

         Queue queue = binding.queue;
        
         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, true, true);

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

         try
         {
           // The actual jmx queue may not have been deployed yet, so we need to the core queue if so,
            // or the acknowledge will have no effect
                       
            boolean deactivate = false;

            if (!queue.isActive())
            {
              queue.activate();

              deactivate = true;
            }

            del.acknowledge(tx);

            if (deactivate)
            {
              queue.deactivate();
            }
View Full Code Here

         return null;
      }

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

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

         return delivery;
      }
     
      if (preserveOrdering && remote)
      {
        //If the header exists it means the message has already been sucked once - so reject.
       
        if (ref.getMessage().getHeader(Message.CLUSTER_SUCKED) != null)
        {
          if (trace) { log.trace("Message has already been sucked once - not sucking again"); }
         
          return null;
        }           
      }

      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!"); }

            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, !selectorRejected, false);

         if (selectorRejected)
         {
            return delivery;
         }
        
         if (noLocal)
         {
            String conId = ((JBossMessage) message).getConnectionID();

            if (trace) { log.trace("message connection id: " + conId + " current connection connection id: " + sessionEndpoint.getConnectionEndpoint().getConnectionID()); }

            if (sessionEndpoint.getConnectionEndpoint().getConnectionID().equals(conId))
            {
              if (trace) { log.trace("Message from local connection so rejecting"); }
             
              try
               {
                 delivery.acknowledge(null);
               }
               catch (Throwable t)
               {
                 log.error("Failed to acknowledge delivery", t);
                
View Full Code Here

      {
         if (failure)
         {
            return null;
         }
         return new SimpleDelivery();
      }
View Full Code Here

         Queue queue = binding.queue;

         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, true, true);

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

         try
         {
           // The actual jmx queue may not have been deployed yet, so we need to the core queue if so,
            // or the acknowledge will have no effect

            boolean deactivate = false;

            if (!queue.isActive())
            {
              queue.activate();

              deactivate = true;
            }

            del.acknowledge(tx);

            if (deactivate)
            {
              queue.deactivate();
            }
View Full Code Here

                    
                     ReferenceInfo mInfo = refInfoMap.get(m.getMessageID());
                     mref.setDeliveryCount(mInfo.getDeliveryCount());
                     mref.setScheduledDeliveryTime(mInfo.getScheduledDelivery());
                    
                     Delivery del = new SimpleDelivery(ch, mref, true, true);
                     del.cancel();
                  }
                  channels.add(ch);
               }
            }
         }
View Full Code Here

         return null;
      }

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

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

         return delivery;
      }
     
      if (preserveOrdering && remote)
      {
        //If the header exists it means the message has already been sucked once - so reject.
       
        if (ref.getMessage().getHeader(Message.CLUSTER_SUCKED) != null)
        {
          if (trace) { log.trace("Message has already been sucked once - not sucking again"); }
         
          return null;
        }           
      }

      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!"); }

            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, !selectorRejected, false);

         if (selectorRejected)
         {
            return delivery;
         }
        
         if (noLocal)
         {
            String conId = ((JBossMessage) message).getConnectionID();

            if (trace) { log.trace("message connection id: " + conId + " current connection connection id: " + sessionEndpoint.getConnectionEndpoint().getConnectionID()); }

            if (sessionEndpoint.getConnectionEndpoint().getConnectionID().equals(conId))
            {
              if (trace) { log.trace("Message from local connection so rejecting"); }
             
              try
               {
                 delivery.acknowledge(null);
               }
               catch (Throwable t)
               {
                 log.error("Failed to acknowledge delivery", t);
                
                 return null;
               }
              
               return delivery;
            }           
         }
                 
                
         sendCount++;
        
         int num = prefetchSize;
        
         if (firstTime)
         {
            //We make sure we have a little extra buffer on the client side
            num = num + num / 3 ;
         }
        
         if (sendCount == num)
         {
            clientAccepting = false;
           
            firstTime = false;
         }        
        
         //now for a remote sucker, we need to update the messages status
         if (remote)
         {
            PersistenceManager pm = sessionEndpoint.getPersistenceManager();
            if (ref.getMessage().isReliable() && messageQueue.isRecoverable())
            {
               try
               {
                  pm.updateMessageState(messageQueue.getChannelID(), ref, "S");
               }
               catch (Exception e)
               {
                  //we need to stop the sucking process. the message should be re-delivered.
                  log.error("Failed to update state for message: " + ref, e);
                  return null;
               }
            }
            delivery.setSucked(true);
         }
        
         try
         {
           sessionEndpoint.handleDelivery(delivery, this);
View Full Code Here

         return null;
      }
     
      if ((!remote) && ref.getMessage().isExpired())
      {
         SimpleDelivery delivery = new SimpleDelivery(observer, ref, true, false);

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

         return delivery;
      }
     
      if (preserveOrdering && remote)
      {
        //If the header exists it means the message has already been sucked once - so reject.
       
        if (ref.getMessage().getHeader(Message.CLUSTER_SUCKED) != null)
        {
          if (trace) { log.trace("Message has already been sucked once - not sucking again"); }
         
          return null;
        }           
      }

      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!"); }

            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, !selectorRejected, false);

         if (selectorRejected)
         {
            return delivery;
         }
        
         if (noLocal)
         {
            String conId = ((JBossMessage) message).getConnectionID();

            if (trace) { log.trace("message connection id: " + conId + " current connection connection id: " + sessionEndpoint.getConnectionEndpoint().getConnectionID()); }

            if (sessionEndpoint.getConnectionEndpoint().getConnectionID().equals(conId))
            {
              if (trace) { log.trace("Message from local connection so rejecting"); }
             
              try
               {
                 delivery.acknowledge(null);
               }
               catch (Throwable t)
               {
                 log.error("Failed to acknowledge delivery", t);
                
                 return null;
               }
              
               return delivery;
            }           
         }
                 
                
         sendCount++;
        
         int num = prefetchSize;
        
         if (firstTime)
         {
            //We make sure we have a little extra buffer on the client side
            num = num + num / 3 ;
         }
        
         if (sendCount == num)
         {
            clientAccepting = false;
           
            firstTime = false;
         }        
        
         //now for a remote sucker, we need to update the messages status
         if (remote)
         {
            PersistenceManager pm = sessionEndpoint.getPersistenceManager();
            if (ref.getMessage().isReliable() && messageQueue.isRecoverable())
            {
               try
               {
                  pm.updateMessageState(messageQueue.getChannelID(), ref, "S");
               }
               catch (Exception e)
               {
                  //we need to stop the sucking process. the message should be re-delivered.
                  log.error("Failed to update state for message: " + ref, e);
                  return null;
               }
            }
            delivery.setSucked(true);
         }
        
         try
         {
           sessionEndpoint.handleDelivery(delivery, this);
View Full Code Here

                    
                     ReferenceInfo mInfo = refInfoMap.get(m.getMessageID());
                     mref.setDeliveryCount(mInfo.getDeliveryCount());
                     mref.setScheduledDeliveryTime(mInfo.getScheduledDelivery());
                    
                     Delivery del = new SimpleDelivery(ch, mref, true, true);
                     del.cancel();
                  }
                  channels.add(ch);
               }
            }
         }
View Full Code Here

TOP

Related Classes of org.jboss.messaging.core.impl.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.