Package org.jboss.jms.message

Examples of org.jboss.jms.message.MessageProxy


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


         messageToSend.setJMSMessageID(null);
      }
      else
      {
         // get the actual message
         MessageProxy proxy = (MessageProxy)m;
                                   
         //The following line executed on the proxy should cause a copy to occur
         //if it is necessary
         proxy.setJMSMessageID(null);
        
         //Get the underlying message
         messageToSend = proxy.getMessage();    
        
         proxy.beforeSend();
      }
     
      // Set the new id
     
      messageToSend.setMessageId(id);
View Full Code Here

                  if (trace) { log.trace(this + ": session " + session + " did not have a set MessageListener"); }
               }

               for (int i = 0; i < mesList.size(); i++)
               {
                  MessageProxy m = (MessageProxy)mesList.get(i);
                  session.addAsfMessage(m, consumerID, queueName, maxDeliveries, sess);
                  if (trace) { log.trace("added " + m + " to session"); }
               }

               if (trace) { log.trace(this + " starting serverSession " + serverSession); }
View Full Code Here

     
      // Need to be redelivered in reverse order.
      for (int i = toRedeliver.size() - 1; i >= 0; i--)
      {
         DeliveryInfo info = (DeliveryInfo)toRedeliver.get(i);
         MessageProxy proxy = info.getMessageProxy();       
        
         MessageCallbackHandler handler = state.getCallbackHandler(info.getConsumerId());
             
         if (handler == null)
         {
View Full Code Here

  
   public Object handleCreateMessage(Invocation invocation) throws Throwable
   {
      JBossMessage jbm = new JBossMessage(0);
      
      return new MessageProxy(jbm);
   }
View Full Code Here

     
      MethodInvocation mi = (MethodInvocation)invocation;
     
      // Load the session with a message to be processed during a subsequent call to run()

      MessageProxy m = (MessageProxy)mi.getArguments()[0];
      int theConsumerID = ((Integer)mi.getArguments()[1]).intValue();
      String queueName = (String)mi.getArguments()[2];
      int maxDeliveries = ((Integer)mi.getArguments()[3]).intValue();
      SessionDelegate connectionConsumerDelegate = ((SessionDelegate)mi.getArguments()[4]);
     
View Full Code Here

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

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

         MessageCallbackHandler handler =
            (MessageCallbackHandler)callbackHandlers.get(new Integer(dr.getConsumerId()));
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);
            }
                 
            sessionDelegate.cancelDeliveries(cancels);
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);
              
               if (!isConnectionConsumer && !ignore)
               {
                  DeliveryInfo info = new DeliveryInfo(m, consumerID, queueName, null);
                                                   
                  m.incDeliveryCount();          
                  sessionDelegate.preDeliver(info);                 
                 
                  sessionDelegate.postDeliver();                                   
               }
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.