Package org.jboss.messaging.core.contract

Examples of org.jboss.messaging.core.contract.Delivery


         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


         //Need to cancel in reverse

         for (int i = toCancel.size() - 1; i >= 0; i--)
         {
            Delivery del = (Delivery)toCancel.get(i);

            try
            {
               del.cancel();
            }
            catch (Throwable t)
            {
               log.error("Failed to cancel delivery", t);
               throw new TransactionException(t.getMessage(), t);
View Full Code Here

   {
      if (trace) {log.trace(this + " cancelDelivery " + cancel); }

      try
      {
         Delivery del = cancelDeliveryInternal(cancel);

         if (del != null)
         {
           //Prompt delivery
           promptDelivery((Channel)del.getObserver());
         }
      }
      catch (Throwable t)
      {
         throw ExceptionUtil.handleJMSInvocation(t, this + " cancelDelivery");
View Full Code Here

         {
            Cancel cancel = (Cancel)cancels.get(i);

            if (trace) { log.trace(this + " cancelling delivery " + cancel.getDeliveryId()); }

            Delivery del = cancelDeliveryInternal(cancel);

            if (del != null)
            {
              channels.add(del.getObserver());
            }
         }

         if (trace) { log.trace("Cancelled deliveries"); }
View Full Code Here

   {
      if (trace) {log.trace(this + " cancelDelivery " + cancel); }

      try
      {
         Delivery del = cancelDeliveryInternal(cancel);

         if (del != null)
         {
           //Prompt delivery
           promptDelivery((Channel)del.getObserver());
         }
      }
      catch (Throwable t)
      {
         throw ExceptionUtil.handleJMSInvocation(t, this + " cancelDelivery");
View Full Code Here

         {
            Cancel cancel = (Cancel)cancels.get(i);

            if (trace) { log.trace(this + " cancelling delivery " + cancel.getDeliveryId()); }

            Delivery del = cancelDeliveryInternal(cancel);

            if (del != null)
            {
              channels.add(del.getObserver());
            }
         }

         if (trace) { log.trace("Cancelled deliveries"); }
View Full Code Here

            Iterator iter3 = acks.iterator();

            while (iter2.hasNext())
            {
               Delivery del = (Delivery)iter2.next();

               DeliveryRecovery info = (DeliveryRecovery)iter3.next();

               long deliveryId = info.getDeliveryID();

               maxDeliveryId = Math.max(maxDeliveryId, deliveryId);

               if (trace) { log.trace(this + " Recovered delivery " + deliveryId + ", " + del); }

               deliveries.put(new Long(deliveryId),
                              new DeliveryRecord(del, dlqToUse, expiryQueueToUse, dest.getRedeliveryDelay(),
                                  maxDeliveryAttemptsToUse, queueName, supportsFailover, deliveryId));

               //We want to replicate the deliveries to the new backup, but we don't want a response since that would cause actual delivery
               //to occur, which we don't want since the client already has the deliveries

               if (supportsFailover)
               {
                 postOffice.sendReplicateDeliveryMessage(queueName, id, del.getReference().getMessage().getMessageID(), deliveryId, false, true);
               }
            }
         }

         iter = postOffice.getAllBindings().iterator();
View Full Code Here

      //might get changed after the client has sent the cancel - and we don't want to end up cancelling
      //back to the original queue
      boolean reachedMaxDeliveryAttempts =
         cancel.isReachedMaxDeliveryAttempts() || cancel.getDeliveryCount() >= rec.maxDeliveryAttempts;

      Delivery del = rec.del;

      if (!expired && !reachedMaxDeliveryAttempts)
      {
         //Normal cancel back to the queue

         del.getReference().setDeliveryCount(cancel.getDeliveryCount());

         //Do we need to set a redelivery delay?

         if (rec.redeliveryDelay != 0)
         {
            del.getReference().setScheduledDeliveryTime(System.currentTimeMillis() + rec.redeliveryDelay);
         }

         if (trace) { log.trace("Cancelling delivery " + cancel.getDeliveryId()); }
         del.cancel();
      }
      else
      {
         if (expired)
         {
            //Sent to expiry queue

            JBossMessage copy = makeCopyForDLQOrExpiry(true, del);

            moveInTransaction(copy, del, rec.expiryQueue, false);
         }
         else
         {
            //Send to DLQ

            JBossMessage copy = makeCopyForDLQOrExpiry(false, del);

            moveInTransaction(copy, del, rec.dlq, true);
         }
      }

      //Need to send a message to the replicant to remove the id
      postOffice.sendReplicateAckMessage(rec.queueName, del.getReference().getMessage().getMessageID());

      return rec.del;
   }
View Full Code Here

           {
             Queue queue = (Queue)iter.next();
            
             if (trace) { log.trace(this + " Routing ref to queue " + queue); }
                       
             Delivery del = queue.handle(null, ref, tx);
            
             if (trace) { log.trace("Queue returned " + del); }

               if (del != null && del.isSelectorAccepted())
               {
                  routed = true;
                 
                  if (remoteSet != null)
                  {
View Full Code Here

      MessageReference ref = createReference(0, false, "payload");
      SimpleDeliveryObserver observer = new SimpleDeliveryObserver();

      // non-transacted send, non-reliable message, one message
      Delivery delivery = queue.handle(observer, ref, null);

      assertTrue(queue.browse(null).isEmpty());

      List received = r.getMessages();
      assertEquals(1, received.size());
View Full Code Here

TOP

Related Classes of org.jboss.messaging.core.contract.Delivery

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.