Package org.hornetq.core.server

Examples of org.hornetq.core.server.Queue


      if (binding == null)
      {
         throw HornetQMessageBundle.BUNDLE.noSuchQueue(queueName);
      }

      Queue queue = (Queue)binding.getBindable();

      // This check is only valid if checkConsumerCount == true
      if (checkConsumerCount && queue.getConsumerCount() != 0)
      {
         throw HornetQMessageBundle.BUNDLE.cannotDeleteQueue(queue.getName(), queueName, binding.getClass().getName());
      }

      if (session != null)
      {

         if (queue.isDurable())
         {
            // make sure the user has privileges to delete this queue
            securityStore.check(binding.getAddress(), CheckType.DELETE_DURABLE_QUEUE, session);
         }
         else
         {
            securityStore.check(binding.getAddress(), CheckType.DELETE_NON_DURABLE_QUEUE, session);
         }
      }

      queue.deleteQueue();
   }
View Full Code Here


            subscription = pagingManager.getPageStore(queueBindingInfo.getAddress())
               .getCursorProvider()
               .createSubscription(queueBindingInfo.getId(), filter, true);
         }

         Queue queue = queueFactory.createQueue(queueBindingInfo.getId(),
            queueBindingInfo.getAddress(),
            queueBindingInfo.getQueueName(),
            filter,
            subscription,
            true,
View Full Code Here

         pageSubscription = pagingManager.getPageStore(address)
            .getCursorProvider()
            .createSubscription(queueID, filter, durable);
      }

      final Queue queue = queueFactory.createQueue(queueID,
         address,
         queueName,
         filter,
         pageSubscription,
         durable,
         temporary);

      if (transientQueue)
      {
         queue.setConsumersRefCount(this);
      }

      binding = new LocalQueueBinding(address, queue, nodeManager.getNodeId());

      if (durable)
      {
         storageManager.addQueueBinding(txID, binding);
      }

      try
      {
         postOffice.addBinding(binding);
         if (durable)
         {
            storageManager.commitBindings(txID);
         }
      }
      catch (Exception e)
      {
         try
         {
            if (durable)
            {
               storageManager.rollbackBindings(txID);
            }
            if (queue != null)
            {
               queue.close();
            }
            if (pageSubscription != null)
            {
               pageSubscription.destroy();
            }
View Full Code Here

         {
            long queueID = entry.getKey();

            Map<Long, AddMessageRecord> queueRecords = entry.getValue();

            Queue queue = queues.get(queueID);

            if (queue == null)
            {
               if (queueRecords.values().size() != 0)
               {
                  HornetQServerLogger.LOGGER.journalCannotFindQueueForMessage(queueID);
               }

               continue;
            }

            // Redistribution could install a Redistributor while we are still loading records, what will be an issue with
            // prepared ACKs
            // We make sure te Queue is paused before we reroute values.
            queue.pause();

            Collection<AddMessageRecord> valueRecords = queueRecords.values();

            long currentTime = System.currentTimeMillis();

            for (AddMessageRecord record : valueRecords)
            {
               long scheduledDeliveryTime = record.scheduledDeliveryTime;

               if (scheduledDeliveryTime != 0 && scheduledDeliveryTime <= currentTime)
               {
                  scheduledDeliveryTime = 0;
                  record.message.removeProperty(Message.HDR_SCHEDULED_DELIVERY_TIME);
               }

               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);
               }
            }
         }

         loadPreparedTransactions(postOffice,
            pagingManager,
            resourceManager,
            queues,
            queueInfos,
            preparedTransactions,
            duplicateIDMap,
            pageSubscriptions,
            pendingLargeMessages);

         for (PageSubscription sub : pageSubscriptions.values())
         {
            sub.getCounter().processReload();
         }

         for (LargeServerMessage msg : largeMessages)
         {
            if (msg.getRefCount() == 0)
            {
               HornetQServerLogger.LOGGER.largeMessageWithNoRef(msg.getMessageID());
               msg.decrementDelayDeletionCount();
            }
         }

         for (ServerMessage msg : messages.values())
         {
            if (msg.getRefCount() == 0)
            {
               HornetQServerLogger.LOGGER.journalUnreferencedMessage(msg.getMessageID());
               try
               {
                  deleteMessage(msg.getMessageID());
               }
               catch (Exception ignored)
               {
                  HornetQServerLogger.LOGGER.journalErrorDeletingMessage(ignored, msg.getMessageID());
               }
            }
         }

         // To recover positions on Iterators
         if (pagingManager != null)
         {
            // it could be null on certain tests that are not dealing with paging
            // This could also be the case in certain embedded conditions
            pagingManager.processReload();
         }

         if (perfBlastPages != -1)
         {
            messageJournal.perfBlast(perfBlastPages);
         }

         for (Queue queue : queues.values())
         {
            queue.resume();
         }

         if (System.getProperty("org.hornetq.opt.directblast") != null)
         {
            messageJournal.runDirectJournalBlast();
View Full Code Here

   // BindingsImpl operations

   public void addQueueBinding(final long tx, final Binding binding) throws Exception
   {
      Queue queue = (Queue)binding.getBindable();

      Filter filter = queue.getFilter();

      SimpleString filterString = filter == null ? null : filter.getFilterString();

      PersistentQueueBindingEncoding bindingEncoding = new PersistentQueueBindingEncoding(queue.getName(),
         binding.getAddress(),
         filterString);

      readLock();
      try
View Full Code Here

                  RefEncoding encoding = new RefEncoding();

                  encoding.decode(buff);

                  Queue queue = queues.get(encoding.queueID);

                  if (queue == null)
                  {
                     HornetQServerLogger.LOGGER.journalMessageInPreparedTX(encoding.queueID);
                  }
                  else
                  {
                     ServerMessage message = messages.get(messageID);

                     if (message == null)
                     {
                        throw new IllegalStateException("Cannot find message with id " + messageID);
                     }

                     postOffice.reroute(message, queue, tx);
                  }

                  break;
               }
               case JournalRecordIds.ACKNOWLEDGE_REF:
               {
                  long messageID = record.id;

                  RefEncoding encoding = new RefEncoding();

                  encoding.decode(buff);

                  Queue queue = queues.get(encoding.queueID);

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

                  MessageReference removed = queue.removeReferenceWithID(messageID);

                  if (removed == null)
                  {
                     HornetQServerLogger.LOGGER.journalErrorRemovingRef(messageID);
                  }
View Full Code Here

         HornetQServerLogger.LOGGER.bridgeQueueNotFound(config.getQueueName(), config.getName());

         return;
      }

      Queue queue = (Queue)binding.getBindable();

      ServerLocatorInternal serverLocator;

      if (config.getDiscoveryGroupName() != null)
      {
View Full Code Here

         props.putSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME, binding.getRoutingName());

         props.putIntProperty(ManagementHelper.HDR_DISTANCE, binding.getDistance());

         Queue theQueue = (Queue)binding.getBindable();

         props.putIntProperty(ManagementHelper.HDR_CONSUMER_COUNT, theQueue.getConsumerCount());

         // HORNETQ-946
         props.putSimpleStringProperty(ManagementHelper.HDR_USER, SimpleString.toSimpleString(username));

         props.putSimpleStringProperty(ManagementHelper.HDR_REMOTE_ADDRESS, SimpleString.toSimpleString(this.remotingConnection.getRemoteAddress()));
View Full Code Here

      else
      {
         securityStore.check(address, CheckType.CREATE_NON_DURABLE_QUEUE, this);
      }

      Queue queue = server.createQueue(address, name, filterString, durable, temporary);

      if (temporary)
      {
         // Temporary queue in core simply means the queue will be deleted if
         // the remoting connection
View Full Code Here

      Binding binding = postOffice.getBinding(name);

      if (binding != null && binding.getType() == BindingType.LOCAL_QUEUE)
      {
         Queue queue = (Queue)binding.getBindable();

         Filter filter = queue.getFilter();

         SimpleString filterString = filter == null ? null : filter.getFilterString();

         response = new QueueQueryResult(name,
                                         binding.getAddress(),
                                         queue.isDurable(),
                                         queue.isTemporary(),
                                         filterString,
                                         queue.getConsumerCount(),
                                         queue.getMessageCount(QueueImpl.DELIVERY_TIMEOUT));
      }
      // make an exception for the management address (see HORNETQ-29)
      else if (name.equals(managementAddress))
      {
         response = new QueueQueryResult(name, managementAddress, true, false, null, -1, -1);
View Full Code Here

TOP

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

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.