Java Code Examples for org.apache.activemq.artemis.core.settings.impl.AddressSettings#getDefaultDelayBeforeDispatch()

The following examples show how to use org.apache.activemq.artemis.core.settings.impl.AddressSettings#getDefaultDelayBeforeDispatch() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActiveMQServerImpl.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
@Override
public BindingQueryResult bindingQuery(SimpleString address, boolean newFQQN) throws Exception {
   if (address == null) {
      throw ActiveMQMessageBundle.BUNDLE.addressIsNull();
   }

   SimpleString realAddress = CompositeAddress.extractAddressName(address);
   AddressSettings addressSettings = getAddressSettingsRepository().getMatch(realAddress.toString());

   boolean autoCreateQeueus = addressSettings.isAutoCreateQueues();
   boolean autoCreateAddresses = addressSettings.isAutoCreateAddresses();
   boolean defaultPurgeOnNoConsumers = addressSettings.isDefaultPurgeOnNoConsumers();
   int defaultMaxConsumers = addressSettings.getDefaultMaxConsumers();
   boolean defaultExclusive = addressSettings.isDefaultExclusiveQueue();
   boolean defaultLastValue = addressSettings.isDefaultLastValueQueue();
   SimpleString defaultLastValueKey = addressSettings.getDefaultLastValueKey();
   boolean defaultNonDestructive = addressSettings.isDefaultNonDestructive();
   int defaultConsumersBeforeDispatch = addressSettings.getDefaultConsumersBeforeDispatch();
   long defaultDelayBeforeDispatch = addressSettings.getDefaultDelayBeforeDispatch();

   List<SimpleString> names = new ArrayList<>();

   // make an exception for the management address (see HORNETQ-29)
   ManagementService managementService = getManagementService();
   if (managementService != null) {
      if (realAddress.equals(managementService.getManagementAddress())) {
         return new BindingQueryResult(true, null, names, autoCreateQeueus, autoCreateAddresses, defaultPurgeOnNoConsumers, defaultMaxConsumers, defaultExclusive, defaultLastValue, defaultLastValueKey, defaultNonDestructive, defaultConsumersBeforeDispatch, defaultDelayBeforeDispatch);
      }
   }

   Bindings bindings = getPostOffice().getMatchingBindings(realAddress);

   for (Binding binding : bindings.getBindings()) {
      if (binding.getType() == BindingType.LOCAL_QUEUE || binding.getType() == BindingType.REMOTE_QUEUE) {
         SimpleString name;
         if (!newFQQN && CompositeAddress.isFullyQualified(address.toString())) {
            // need to use the FQQN here for backwards compatibility with core JMS client
            name = CompositeAddress.toFullyQualified(realAddress, binding.getUniqueName());
         } else {
            name = binding.getUniqueName();
         }
         names.add(name);
      }
   }

   AddressInfo info = getAddressInfo(realAddress);

   return new BindingQueryResult(info != null, info, names, autoCreateQeueus, autoCreateAddresses, defaultPurgeOnNoConsumers, defaultMaxConsumers, defaultExclusive, defaultLastValue, defaultLastValueKey, defaultNonDestructive, defaultConsumersBeforeDispatch, defaultDelayBeforeDispatch);
}
 
Example 2
Source File: ActiveMQServerImpl.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
@Override
public QueueQueryResult queueQuery(SimpleString name) {
   if (name == null) {
      throw ActiveMQMessageBundle.BUNDLE.queueNameIsNull();
   }

   SimpleString realName = CompositeAddress.extractQueueName(name);

   final QueueQueryResult response;

   Binding binding = getPostOffice().getBinding(realName);

   final SimpleString addressName = binding != null && binding.getType() == BindingType.LOCAL_QUEUE
         ? binding.getAddress() : CompositeAddress.extractAddressName(name);

   final AddressSettings addressSettings = getAddressSettingsRepository().getMatch(addressName.toString());

   boolean autoCreateQueues = addressSettings.isAutoCreateQueues();
   boolean defaultPurgeOnNoConsumers = addressSettings.isDefaultPurgeOnNoConsumers();
   int defaultMaxConsumers = addressSettings.getDefaultMaxConsumers();
   boolean defaultExclusiveQueue = addressSettings.isDefaultExclusiveQueue();
   boolean defaultLastValueQueue = addressSettings.isDefaultLastValueQueue();
   SimpleString defaultLastValueKey = addressSettings.getDefaultLastValueKey();
   boolean defaultNonDestructive = addressSettings.isDefaultNonDestructive();
   int defaultConsumersBeforeDispatch = addressSettings.getDefaultConsumersBeforeDispatch();
   long defaultDelayBeforeDispatch = addressSettings.getDefaultDelayBeforeDispatch();
   int defaultConsumerWindowSize = addressSettings.getDefaultConsumerWindowSize();
   boolean defaultGroupRebalance = addressSettings.isDefaultGroupRebalance();
   int defaultGroupBuckets = addressSettings.getDefaultGroupBuckets();
   SimpleString defaultGroupFirstKey = addressSettings.getDefaultGroupFirstKey();
   long autoDeleteQueuesDelay = addressSettings.getAutoDeleteQueuesDelay();
   long autoDeleteQueuesMessageCount = addressSettings.getAutoDeleteQueuesMessageCount();
   long defaultRingSize = addressSettings.getDefaultRingSize();
   boolean defaultEnabled = ActiveMQDefaultConfiguration.getDefaultEnabled();

   SimpleString managementAddress = getManagementService() != null ? getManagementService().getManagementAddress() : null;

   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(realName, binding.getAddress(), queue.isDurable(), queue.isTemporary(), filterString, queue.getConsumerCount(), queue.getMessageCount(), autoCreateQueues, true, queue.isAutoCreated(), queue.isPurgeOnNoConsumers(), queue.getRoutingType(), queue.getMaxConsumers(), queue.isExclusive(), queue.isGroupRebalance(), queue.getGroupBuckets(), queue.getGroupFirstKey(), queue.isLastValue(), queue.getLastValueKey(), queue.isNonDestructive(), queue.getConsumersBeforeDispatch(), queue.getDelayBeforeDispatch(), queue.isAutoDelete(), queue.getAutoDeleteDelay(), queue.getAutoDeleteMessageCount(), defaultConsumerWindowSize, queue.getRingSize(), queue.isEnabled());
   } else if (realName.equals(managementAddress)) {
      // make an exception for the management address (see HORNETQ-29)
      response = new QueueQueryResult(realName, managementAddress, true, false, null, -1, -1, autoCreateQueues, true, false, false, RoutingType.MULTICAST, -1, false, false, null, null, null,null, null, null, null, null, null, null, defaultConsumerWindowSize, null, null);
   } else {
      response = new QueueQueryResult(realName, addressName, true, false, null, 0, 0, autoCreateQueues, false, false, defaultPurgeOnNoConsumers, RoutingType.MULTICAST, defaultMaxConsumers, defaultExclusiveQueue, defaultGroupRebalance, defaultGroupBuckets, defaultGroupFirstKey, defaultLastValueQueue, defaultLastValueKey, defaultNonDestructive, defaultConsumersBeforeDispatch, defaultDelayBeforeDispatch, isAutoDelete(false, addressSettings), autoDeleteQueuesDelay, autoDeleteQueuesMessageCount, defaultConsumerWindowSize, defaultRingSize, defaultEnabled);
   }

   return response;
}