Package org.jboss.jms.delegate

Examples of org.jboss.jms.delegate.DeliveryInfo


            iter2 = acks.iterator();

            while (iter2.hasNext())
            {
               DeliveryInfo ack = (DeliveryInfo) iter2.next();

               //We don't want to send acks for things like non durable subs which will have been already acked
               if (ack.isShouldAck())
               {
                  //We only need the delivery id written
                  out.writeLong(ack.getMessageProxy().getDeliveryId());
               }
            }

            //Marker for end of acks
            out.writeLong(Long.MIN_VALUE);
View Full Code Here


            serverID = newServerID;

            // Remove any non persistent acks
            for (Iterator i = acks.iterator(); i.hasNext();)
            {
               DeliveryInfo di = (DeliveryInfo) i.next();

               if (!di.getMessageProxy().getMessage().isReliable())
               {
                  if (trace)
                  {
                     log.trace(this + " discarded non-persistent " + di + " on failover");
                  }
View Full Code Here

      {
         //Message has been cancelled
         return;
      }
     
      DeliveryInfo deliveryInfo =
         new DeliveryInfo(m, consumerID, queueName, connectionConsumerSession, shouldAck, null);
           
      m.incDeliveryCount();
     
      // If this is the callback-handler for a connection consumer we don't want to acknowledge or
      // add anything to the tx for this session.
View Full Code Here

      {
         //Message has been cancelled
         return;
      }
     
      DeliveryInfo deliveryInfo =
         new DeliveryInfo(m, consumerID, queueName, connectionConsumerSession, shouldAck, m.getSource());
           
      m.incDeliveryCount();
     
      // If this is the callback-handler for a connection consumer we don't want to acknowledge or
      // add anything to the tx for this session.
View Full Code Here

               boolean ignore =
                  checkExpiredOrReachedMaxdeliveries(m, sessionDelegate, maxDeliveries, shouldAck);
              
               if (!isConnectionConsumer && !ignore)
               {
                  final DeliveryInfo info = new DeliveryInfo(m, consumerID, queueName, null, shouldAck, m.getSource());
                 
                  if (timeout <= 0 || sessionDelegate.getTransacted())
                  {
                     ignore = ! sessionDelegate.preDeliver(info);
View Full Code Here

     
      if (ackMode == Session.AUTO_ACKNOWLEDGE || isXAAndConsideredNonTransacted(state))
      {
         //Acknowledge or cancel any outstanding auto ack
       
         DeliveryInfo remainingAutoAck = state.getAutoAckInfo();
        
         if (remainingAutoAck != null)
         {
            if (trace) { log.trace(this + " handleClosing(). Found remaining auto ack. Will ack " + remainingAutoAck); }
           
View Full Code Here

      {
     
         int ackMode = state.getAcknowledgeMode();
        
         Object[] args = mi.getArguments();
         DeliveryInfo info = (DeliveryInfo)args[0];
        
         if (ackMode == Session.CLIENT_ACKNOWLEDGE)
         {
            // We collect acknowledgments in the list
           
            if (trace) { log.trace(this + " added to CLIENT_ACKNOWLEDGE list delivery " + info); }
           
            // Sanity check
            if (info.getConnectionConsumerSession() != null)
            {
               throw new IllegalStateException(
                  "CLIENT_ACKNOWLEDGE cannot be used with a connection consumer");
            }
           
            result = state.addToClientAckList(info);
              
         }
         // if XA and there is no transaction enlisted on XA we will act as AutoAcknowledge
         // However if it's a MDB (if there is a DistinguishedListener) we should behaved as transacted
         else if (ackMode == Session.AUTO_ACKNOWLEDGE || isXAAndConsideredNonTransacted(state))
         {
            // We collect the single acknowledgement in the state.
                             
            if (trace) { log.trace(this + " added " + info + " to session state"); }
           
            state.setAutoAckInfo(info);        
         }
         else if (ackMode == Session.DUPS_OK_ACKNOWLEDGE)
         {
            if (trace) { log.trace(this + " added to DUPS_OK_ACKNOWLEDGE list delivery " + info); }
           
            state.getClientAckList().add(info);
           
            //Also set here - this would be used for recovery in a message listener
            state.setAutoAckInfo(info);
         }
         else
         {            
            Object txID = state.getCurrentTxId();
     
            if (txID != null)
            {
               // the session is non-XA and transacted, or XA and enrolled in a global transaction. An
               // XA session that has not been enrolled in a global transaction behaves as a
               // transacted session.
              
               ConnectionState connState = (ConnectionState)state.getParent();
     
               if (trace) { log.trace("sending acknowlegment transactionally, queueing on resource manager"); }
     
               // If the ack is for a delivery that came through via a connection consumer then we use
               // the connectionConsumer session as the session id, otherwise we use this sessions'
               // session ID
              
               ClientSessionDelegate connectionConsumerDelegate =
                  (ClientSessionDelegate)info.getConnectionConsumerSession();
              
               String sessionId = connectionConsumerDelegate != null ?
                  connectionConsumerDelegate.getID() : state.getSessionID();
              
               if (info.getSource() != null)
               {
                  //from a normal session (non CC).
                  result = state.addAckToResourceManager(connState.getResourceManager(), txID, sessionId, info);
               }
               else
View Full Code Here

            // It is possible that session.recover() is called inside a message listener onMessage
            // method - i.e. between the invocations of preDeliver and postDeliver. In this case we
            // don't want to acknowledge the last delivered messages - since it will be redelivered.
            if (!state.isRecoverCalled())
            {
               DeliveryInfo delivery = state.getAutoAckInfo();
              
               if (delivery == null)
               {
                  throw new IllegalStateException("Cannot find delivery to AUTO_ACKNOWLEDGE");
               }
View Full Code Here

  
            state.setRecoverCalled(true);
         }
         else if (ackMode == Session.AUTO_ACKNOWLEDGE || ackMode == Session.DUPS_OK_ACKNOWLEDGE || isXAAndConsideredNonTransacted(state))
         {
            DeliveryInfo info = state.getAutoAckInfo();
           
            //Don't recover if it's already to cancel
           
            if (info != null)
            {
View Full Code Here

      SessionDelegate del = (SessionDelegate)mi.getTargetObject();
     
      // 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();       
        
         ClientConsumer handler = state.getCallbackHandler(info.getConsumerId());
        
         if (handler == null)
         {
            // This is ok. The original consumer has closed, so we cancel the message
           
View Full Code Here

TOP

Related Classes of org.jboss.jms.delegate.DeliveryInfo

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.