Package org.hornetq.core.server

Examples of org.hornetq.core.server.MessageReference


            if (holder.iter == null)
            {
               holder.iter = messageReferences.iterator();
            }

            MessageReference ref;

            if (holder.iter.hasNext())
            {
               ref = holder.iter.next();
            }
            else
            {
               ref = null;
            }

            if (ref == null)
            {
               nullRefCount++;
            }
            else
            {
               if (checkExpired(ref))
               {
                  if (isTrace)
                  {
                     log.trace("Reference " + ref + " being expired");
                  }
                  holder.iter.remove();

                  refRemoved(ref);

                  handled++;

                  continue;
               }

               Consumer groupConsumer = null;

               if (isTrace)
               {
                  log.trace("Queue " + this.getName() + " is delivering reference " + ref);
               }

               // If a group id is set, then this overrides the consumer chosen round-robin

               SimpleString groupID = ref.getMessage().getSimpleStringProperty(Message.HDR_GROUP_ID);

               if (groupID != null)
               {
                  groupConsumer = groups.get(groupID);
View Full Code Here


      Transaction tx = new TransactionImpl(storageManager);

      while (iter.hasNext())
      {
         MessageReference ref = iter.next();

         ref.getQueue().cancel(tx, ref);
      }

      tx.rollback();

      if (!browseOnly)
View Full Code Here

      }
     
      try
      {
  
         MessageReference ref;
         do
         {
            ref = deliveringRefs.poll();
           
            if (log.isTraceEnabled())
            {
               log.trace("ACKing ref " + ref + " on " + this);
            }
  
            if (ref == null)
            {
              
               HornetQException e = new HornetQException(HornetQException.ILLEGAL_STATE, "Could not find reference on consumerID=" +
                                id +
                                ", messageId = " +
                                messageID +
                                " queue = " +
                                messageQueue.getName());
               throw e;
            }
  
            ref.getQueue().acknowledge(tx, ref);
         }
         while (ref.getMessage().getMessageID() != messageID);
        
         if (startedTransaction)
         {
            tx.commit();
         }
View Full Code Here

      if (browseOnly)
      {
         return;
      }

      MessageReference ref = removeReferenceByID(messageID);

      if (ref == null)
      {
         throw new IllegalStateException("Cannot find ref to ack " + messageID);
      }

      if (autoCommitAcks)
      {
         ref.getQueue().acknowledge(ref);
      }
      else
      {
         ref.getQueue().acknowledge(tx, ref);
      }
   }
View Full Code Here

      // Expiries can come in out of sequence with respect to delivery order

      Iterator<MessageReference> iter = deliveringRefs.iterator();

      MessageReference ref = null;

      while (iter.hasNext())
      {
         MessageReference theRef = iter.next();

         if (theRef.getMessage().getMessageID() == messageID)
         {
            iter.remove();

            ref = theRef;
View Full Code Here

            }
         }

         while (iterator.hasNext())
         {
            MessageReference ref = iterator.next();
            try
            {
               HandleStatus status = handle(ref);
               if (status == HandleStatus.BUSY)
               {
View Full Code Here

   public MessageReference reroute(final ServerMessage message, final Queue queue, final Transaction tx) throws Exception
   {
      setPagingStore(message);

      MessageReference reference = message.createReference(queue);

      if (message.containsProperty(Message.HDR_SCHEDULED_DELIVERY_TIME))
      {
         Long scheduledDeliveryTime = message.getLongProperty(Message.HDR_SCHEDULED_DELIVERY_TIME);
         reference.setScheduledDeliveryTime(scheduledDeliveryTime);
      }

      message.incrementDurableRefCount();

      message.incrementRefCount();
View Full Code Here

            continue;
         }

         for (Queue queue : entry.getValue().getNonDurableQueues())
         {
            MessageReference reference = message.createReference(queue);

            refs.add(reference);

            if (message.containsProperty(Message.HDR_SCHEDULED_DELIVERY_TIME))
            {
               Long scheduledDeliveryTime = message.getLongProperty(Message.HDR_SCHEDULED_DELIVERY_TIME);

               reference.setScheduledDeliveryTime(scheduledDeliveryTime);
            }

            message.incrementRefCount();
         }

         Iterator<Queue> iter = entry.getValue().getDurableQueues().iterator();

         while (iter.hasNext())
         {
            Queue queue = iter.next();

            MessageReference reference = message.createReference(queue);

            refs.add(reference);

            if (message.containsProperty(Message.HDR_SCHEDULED_DELIVERY_TIME))
            {
               Long scheduledDeliveryTime = message.getLongProperty(Message.HDR_SCHEDULED_DELIVERY_TIME);

               reference.setScheduledDeliveryTime(scheduledDeliveryTime);
            }

            if (message.isDurable())
            {
               int durableRefCount = message.incrementDurableRefCount();
View Full Code Here

            if (scheduledDeliveryTime != 0)
            {
               record.message.putLongProperty(Message.HDR_SCHEDULED_DELIVERY_TIME, scheduledDeliveryTime);
            }

            MessageReference ref = postOffice.reroute(record.message, queue, null);

            ref.setDeliveryCount(record.deliveryCount);

            if (scheduledDeliveryTime != 0)
            {
               record.message.removeProperty(Message.HDR_SCHEDULED_DELIVERY_TIME);
            }
View Full Code Here

                  if (queue == null)
                  {
                     throw new IllegalStateException("Cannot find queue with id " + encoding.queueID);
                  }

                  MessageReference removed = queue.removeReferenceWithID(messageID);

                  if (removed == null)
                  {
                     log.warn("Failed to remove reference for " + messageID);
                  }
View Full Code Here

TOP

Related Classes of org.hornetq.core.server.MessageReference

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.