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

The following examples show how to use org.apache.activemq.artemis.core.settings.impl.AddressSettings#getDeadLetterAddress() . 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: QueueControlImpl.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
@Override
public String getDeadLetterAddress() {
   if (AuditLogger.isEnabled()) {
      AuditLogger.getDeadLetterAddress(queue);
   }
   checkStarted();

   clearIO();
   try {
      AddressSettings addressSettings = addressSettingsRepository.getMatch(address);

      if (addressSettings != null && addressSettings.getDeadLetterAddress() != null) {
         return addressSettings.getDeadLetterAddress().toString();
      }
      return null;
   } finally {
      blockOnIO();
   }
}
 
Example 2
Source File: QueueImpl.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
private void createDeadLetterResources() throws Exception {
   AddressSettings addressSettings = server.getAddressSettingsRepository().getMatch(getAddress().toString());
   if (addressSettings.isAutoCreateDeadLetterResources() && !getAddress().equals(addressSettings.getDeadLetterAddress())) {
      if (addressSettings.getDeadLetterAddress() != null && addressSettings.getDeadLetterAddress().length() != 0) {
         SimpleString dlqName = addressSettings.getDeadLetterQueuePrefix().concat(getAddress()).concat(addressSettings.getDeadLetterQueueSuffix());
         SimpleString dlqFilter = new SimpleString(String.format("%s = '%s'", Message.HDR_ORIGINAL_ADDRESS, getAddress()));
         server.createQueue(new QueueConfiguration(dlqName).setAddress(addressSettings.getDeadLetterAddress()).setFilterString(dlqFilter).setAutoCreated(true).setAutoCreateAddress(true), true);
      }
   }
}
 
Example 3
Source File: QueueImpl.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
private void checkDeadLetterAddressAndExpiryAddress(final AddressSettings settings) {
   if (!Env.isTestEnv() && !internalQueue && !address.equals(server.getConfiguration().getManagementNotificationAddress())) {
      if (settings.getDeadLetterAddress() == null) {
         ActiveMQServerLogger.LOGGER.AddressSettingsNoDLA(name);
      }
      if (settings.getExpiryAddress() == null) {
         ActiveMQServerLogger.LOGGER.AddressSettingsNoExpiryAddress(name);
      }
   }
}
 
Example 4
Source File: ActiveMQServerControlImpl.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
@Override
public String getAddressSettingsAsJSON(final String address) throws Exception {
   if (AuditLogger.isEnabled()) {
      AuditLogger.getAddressSettingsAsJSON(this.server, address);
   }
   checkStarted();

   AddressSettings addressSettings = server.getAddressSettingsRepository().getMatch(address);
   String policy = addressSettings.getAddressFullMessagePolicy() == AddressFullMessagePolicy.PAGE ? "PAGE" : addressSettings.getAddressFullMessagePolicy() == AddressFullMessagePolicy.BLOCK ? "BLOCK" : addressSettings.getAddressFullMessagePolicy() == AddressFullMessagePolicy.DROP ? "DROP" : "FAIL";
   String consumerPolicy = addressSettings.getSlowConsumerPolicy() == SlowConsumerPolicy.NOTIFY ? "NOTIFY" : "KILL";
   JsonObjectBuilder settings = JsonLoader.createObjectBuilder();
   if (addressSettings.getDeadLetterAddress() != null) {
      settings.add("DLA", addressSettings.getDeadLetterAddress().toString());
   }
   if (addressSettings.getExpiryAddress() != null) {
      settings.add("expiryAddress", addressSettings.getExpiryAddress().toString());
   }

   return settings.add("expiryDelay", addressSettings.getExpiryDelay())
         .add("minExpiryDelay", addressSettings.getMinExpiryDelay())
         .add("maxExpiryDelay", addressSettings.getMaxExpiryDelay())
         .add("maxDeliveryAttempts", addressSettings.getMaxDeliveryAttempts())
         .add("pageCacheMaxSize", addressSettings.getPageCacheMaxSize())
         .add("maxSizeBytes", addressSettings.getMaxSizeBytes())
         .add("pageSizeBytes", addressSettings.getPageSizeBytes())
         .add("redeliveryDelay", addressSettings.getRedeliveryDelay())
         .add("redeliveryMultiplier", addressSettings.getRedeliveryMultiplier())
         .add("maxRedeliveryDelay", addressSettings.getMaxRedeliveryDelay())
         .add("redistributionDelay", addressSettings.getRedistributionDelay())
         .add("lastValueQueue", addressSettings.isDefaultLastValueQueue())
         .add("sendToDLAOnNoRoute", addressSettings.isSendToDLAOnNoRoute())
         .add("addressFullMessagePolicy", policy)
         .add("slowConsumerThreshold", addressSettings.getSlowConsumerThreshold())
         .add("slowConsumerCheckPeriod", addressSettings.getSlowConsumerCheckPeriod())
         .add("slowConsumerPolicy", consumerPolicy)
         .add("autoCreateJmsQueues", addressSettings.isAutoCreateJmsQueues())
         .add("autoDeleteJmsQueues", addressSettings.isAutoDeleteJmsQueues())
         .add("autoCreateJmsTopics", addressSettings.isAutoCreateJmsTopics())
         .add("autoDeleteJmsTopics", addressSettings.isAutoDeleteJmsTopics())
         .add("autoCreateQueues", addressSettings.isAutoCreateQueues())
         .add("autoDeleteQueues", addressSettings.isAutoDeleteQueues())
         .add("autoCreateAddresses", addressSettings.isAutoCreateAddresses())
         .add("autoDeleteAddresses", addressSettings.isAutoDeleteAddresses())
         .add("configDeleteQueues", addressSettings.getConfigDeleteQueues().toString())
         .add("configDeleteAddresses", addressSettings.getConfigDeleteAddresses().toString())
         .add("maxSizeBytesRejectThreshold", addressSettings.getMaxSizeBytesRejectThreshold())
         .add("defaultLastValueKey", addressSettings.getDefaultLastValueKey() == null ? "" : addressSettings.getDefaultLastValueKey().toString())
         .add("defaultNonDestructive", addressSettings.isDefaultNonDestructive())
         .add("defaultExclusiveQueue", addressSettings.isDefaultExclusiveQueue())
         .add("defaultGroupRebalance", addressSettings.isDefaultGroupRebalance())
         .add("defaultGroupBuckets", addressSettings.getDefaultGroupBuckets())
         .add("defaultGroupFirstKey", addressSettings.getDefaultGroupFirstKey() == null ? "" : addressSettings.getDefaultGroupFirstKey().toString())
         .add("defaultMaxConsumers", addressSettings.getDefaultMaxConsumers())
         .add("defaultPurgeOnNoConsumers", addressSettings.isDefaultPurgeOnNoConsumers())
         .add("defaultConsumersBeforeDispatch", addressSettings.getDefaultConsumersBeforeDispatch())
         .add("defaultDelayBeforeDispatch", addressSettings.getDefaultDelayBeforeDispatch())
         .add("defaultQueueRoutingType", addressSettings.getDefaultQueueRoutingType().toString())
         .add("defaultAddressRoutingType", addressSettings.getDefaultAddressRoutingType().toString())
         .add("defaultConsumerWindowSize", addressSettings.getDefaultConsumerWindowSize())
         .add("defaultRingSize", addressSettings.getDefaultRingSize())
         .add("autoDeleteCreatedQueues", addressSettings.isAutoDeleteCreatedQueues())
         .add("autoDeleteQueuesDelay", addressSettings.getAutoDeleteQueuesDelay())
         .add("autoDeleteQueuesMessageCount", addressSettings.getAutoDeleteQueuesMessageCount())
         .add("autoDeleteAddressesDelay", addressSettings.getAutoDeleteAddressesDelay())
         .add("redeliveryCollisionAvoidanceFactor", addressSettings.getRedeliveryCollisionAvoidanceFactor())
         .add("retroactiveMessageCount", addressSettings.getRetroactiveMessageCount())
         .add("autoCreateDeadLetterResources", addressSettings.isAutoCreateDeadLetterResources())
         .add("deadLetterQueuePrefix", addressSettings.getDeadLetterQueuePrefix().toString())
         .add("deadLetterQueueSuffix", addressSettings.getDeadLetterQueueSuffix().toString())
         .add("autoCreateExpiryResources", addressSettings.isAutoCreateExpiryResources())
         .add("expiryQueuePrefix", addressSettings.getExpiryQueuePrefix().toString())
         .add("expiryQueueSuffix", addressSettings.getExpiryQueueSuffix().toString())
         .add("enableMetrics", addressSettings.isEnableMetrics())
         .build()
         .toString();
}