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 + " pushing " + ref);
                  }

                  Delivery del = distributor.handle(this, ref, null);

                  setReceiversReady(del != null);

                  if (del == null)
                  {

                     // No receiver, broken receiver or full receiver so we stop delivering
                     if (trace)
                     {
                        log.trace(this + " got no delivery for " +
                                  ref +
                                  " so no receiver got the message. Stopping delivery.");
                     }

                     break;
                  }
                  else if (!del.isSelectorAccepted())
                  {
                     // No receiver accepted the message because no selectors matched, so we create
                     // an iterator (if we haven't already created it) to iterate through the refs
                     // in the channel. No delivery was really performed
View Full Code Here

         {
            // Attempt to push the ref to a receiver

            if (trace) { log.trace(this + " pushing " + ref); }

            Delivery del = distributor.handle(this, ref, null);

            setReceiversReady(del != null);

            if (del == null)
            {
               // No receiver, broken receiver or full receiver so we stop delivering
               if (trace) { log.trace(this + ": no delivery returned for message" + ref + " so no receiver got the message. Delivery is now complete"); }

               return false;
            }
            else if (del.isSelectorAccepted())
            {
               if (trace) { log.trace(this + ": " + del + " returned for message:" + ref); }

               // Receiver accepted the reference
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

                    
                     ReferenceInfo mInfo = refInfoMap.get(m.getMessageID());
                     mref.setDeliveryCount(mInfo.getDeliveryCount());
                     mref.setScheduledDeliveryTime(mInfo.getScheduledDelivery());
                    
                     Delivery del = new SimpleDelivery(ch, mref, true, true);
                     del.cancel();
                  }
               }
            }
         }
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

            if (debug) { log.debug("Sending expired message: " + rec.del.getReference() + " to expiry queue " + rec.expiryQueue); }
            JBossMessage copy = makeCopyForDLQOrExpiry(true, del);

            moveInTransaction(copy, del, rec.expiryQueue, false);
         }
         else
         {
            //Send to DLQ
            if (debug) { log.debug("Sending message: " + rec.del.getReference() + " to dlq " + rec.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 = binding.queue;

         Long scid = (Long)ref.getMessage().removeHeader(Message.SOURCE_CHANNEL_ID);

         Delivery del = queue.handleMove(ref, scid.longValue());

        if (del == null)
        {
          throw new JMSException("Failed to route " + ref + " to " + dest.getName());
        }
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.