Package org.jboss.jms.message

Examples of org.jboss.jms.message.MessageProxy


            if (trace) { log.trace("InterruptedException, " + this + ".getMessage() returning null"); }
            return null;
         }
      }

      MessageProxy m = null;
            
      if (!closed && !buffer.isEmpty())
      {
         m = (MessageProxy)buffer.removeFirst();
        
View Full Code Here


    */
   private class ListenerRunner implements Runnable
   {
      public void run()
      {        
         MessageProxy mp = null;
        
         MessageListener theListener = null;
        
         synchronized (mainLock)
         {
View Full Code Here

      {
         ClientDelivery dr = (ClientDelivery)parameter;
         
         Message msg = dr.getMessage();
        
         MessageProxy proxy = JBossMessage.
            createThinDelegate(dr.getDeliveryId(), (JBossMessage)msg, dr.getDeliveryCount());

         ClientConsumer handler =
            (ClientConsumer)callbackHandlers.get(dr.getConsumerId());
View Full Code Here

   {
      ClientDelivery del = (ClientDelivery)message;
     
      Message msg = del.getMessage();
     
      MessageProxy proxy = JBossMessage.
         createThinDelegate(del.getDeliveryId(), (JBossMessage)msg, del.getDeliveryCount());

      //TODO - we temporarily need to execute on a different thread to avoid a deadlock situation in
      //       failover where a message is sent then the valve is locked, and the message send cause
      //       a message delivery back to the same client which tries to ack but can't get through
View Full Code Here

  
            List cancels = new ArrayList();
  
            for(Iterator i = buffer.iterator(); i.hasNext();)
            {
               MessageProxy mp = (MessageProxy)i.next();
              
               DefaultCancel cancel =
                  new DefaultCancel(mp.getDeliveryId(), mp.getDeliveryCount(), false, false);
              
               cancels.add(cancel);
            }
                 
            if (trace) { log.trace("Calling cancelDeliveries"); }
View Full Code Here

    *        or null if one is not immediately available. Returns null if the consumer is
    *        concurrently closed.
    */
   public MessageProxy receive(long timeout) throws JMSException
   {               
      MessageProxy m = null;     
     
      synchronized (mainLock)
      {       
         if (trace) { log.trace(this + " receiving, timeout = " + timeout); }
        
         if (closed)
         {
            // If consumer is closed or closing calling receive returns null
            if (trace) { log.trace(this + " closed, returning null"); }
            return null;
         }
        
         if (listener != null)
         {
            throw new JMSException("The consumer has a MessageListener set, " +
               "cannot call receive(..)");
         }
                      
         receiverThread = Thread.currentThread();
              
         long startTimestamp = System.currentTimeMillis();
                 
         try
         {
            while(true)
            {                            
               if (timeout == 0)
               {
                  if (trace) { log.trace(this + ": receive, no timeout"); }
                 
                  m = getMessage(0);                    
                 
                  if (m == null)
                  {
                     return null;
                  }
               }
               else if (timeout == -1)
               {
                  //ReceiveNoWait
                  if (trace) { log.trace(this + ": receive, noWait"); }
                 
                  m = getMessage(-1);                    
                 
                  if (m == null)
                  {
                     if (trace) { log.trace(this + ": no message available"); }
                     return null;
                  }
               }
               else
               {
                  if (trace) { log.trace(this + ": receive, timeout " + timeout + " ms, blocking poll on queue"); }
                 
                  m = getMessage(timeout);
                                   
                  if (m == null)
                  {
                     // timeout expired
                     if (trace) { log.trace(this + ": " + timeout + " ms timeout expired"); }
                    
                     return null;
                  }
               }
                             
               if (trace) { log.trace(this + " received " + m + " after being blocked on buffer"); }
                      
               boolean ignore =
                  checkExpiredOrReachedMaxdeliveries(m, sessionDelegate, maxDeliveries, shouldAck);
              
               if (!isConnectionConsumer && !ignore)
               {
                  DeliveryInfo info = new DeliveryInfo(m, consumerID, queueName, null, shouldAck);
                                                   
                  sessionDelegate.preDeliver(info);                 
                 
                  //If post deliver didn't succeed and acknowledgement mode is auto_ack
                  //That means the ref wasn't acked since it couldn't be found.
                  //In order to maintain at most once semantics we must therefore not return
                  //the message
                 
                  ignore = !sessionDelegate.postDeliver()
                 
                  if (trace)
                  {
                    log.trace("Post deliver returned " + !ignore);
                  }
                 
                  if (!ignore)
                  {
                     m.incDeliveryCount();                               
                  }
               }
                                            
               if (!ignore)
               {
View Full Code Here

            if (trace) { log.trace("InterruptedException, " + this + ".getMessage() returning null"); }
            return null;
         }
      }

      MessageProxy m = null;
            
      if (!closed && !buffer.isEmpty())
      {
         m = (MessageProxy)buffer.removeFirst();
      }
View Full Code Here

    */
   private class ListenerRunner implements Runnable
   {
      public void run()
      {        
         MessageProxy mp = null;
        
         MessageListener theListener = null;
        
         synchronized (mainLock)
         {
View Full Code Here

        
         if (!acks.isEmpty())
         {
            DeliveryInfo info = (DeliveryInfo)acks.get(0);
           
            MessageProxy mp = info.getMessageProxy();
           
            SessionDelegate del = mp.getSessionDelegate();
           
            del.redeliver(acks);
         }
      }
   }
View Full Code Here

  
   // Private -------------------------------------------------------

   private void receiveMessage(String text, MessageConsumer consumer, boolean shouldAssert, boolean shouldBeNull) throws Exception
   {
      MessageProxy message = (MessageProxy) consumer.receive(3000);
      TextMessage txtMessage = (TextMessage) message;
      if (message != null)
      {
         log.info(text + ": messageID from messageReceived=" + message.getMessage().getMessageID() + " message = " + message + " content=" + txtMessage.getText());
      }
      else
      {
         log.info(text + ": Message received was null");
      }
View Full Code Here

TOP

Related Classes of org.jboss.jms.message.MessageProxy

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.