コード例 #1
0
ファイル: HornetNest.java プロジェクト: znepok/activeweb
 private void configurePaging() {
   AddressSettings addressSettings = new AddressSettings();
   addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE);
   addressSettings.setMaxSizeBytes(30 * 1024 * 1024);
   addressSettings.setPageSizeBytes(10 * 1024 * 1024);
   addressSettings.setPageCacheMaxSize(20);
   config.getAddressesSettings().put("jms.queue.*", addressSettings);
 }
コード例 #2
0
  /**
   * Create a setting.
   *
   * @param context the operation context
   * @param config the detyped config
   * @return the address settings
   * @throws OperationFailedException if the model is invalid
   */
  static AddressSettings createSettings(final OperationContext context, final ModelNode config)
      throws OperationFailedException {
    final AddressSettings settings = new AddressSettings();

    if (config.hasDefined(AddressSettingDefinition.ADDRESS_FULL_MESSAGE_POLICY.getName())) {
      final AddressFullMessagePolicy addressPolicy =
          AddressFullMessagePolicy.valueOf(
              AddressSettingDefinition.ADDRESS_FULL_MESSAGE_POLICY
                  .resolveModelAttribute(context, config)
                  .asString());
      settings.setAddressFullMessagePolicy(addressPolicy);
    }
    if (config.hasDefined(DEAD_LETTER_ADDRESS.getName())) {
      settings.setDeadLetterAddress(
          asSimpleString(DEAD_LETTER_ADDRESS.resolveModelAttribute(context, config), null));
    }
    if (config.hasDefined(AddressSettingDefinition.LAST_VALUE_QUEUE.getName())) {
      settings.setLastValueQueue(
          AddressSettingDefinition.LAST_VALUE_QUEUE
              .resolveModelAttribute(context, config)
              .asBoolean());
    }
    if (config.hasDefined(AddressSettingDefinition.MAX_DELIVERY_ATTEMPTS.getName())) {
      settings.setMaxDeliveryAttempts(
          AddressSettingDefinition.MAX_DELIVERY_ATTEMPTS
              .resolveModelAttribute(context, config)
              .asInt());
    }
    if (config.hasDefined(AddressSettingDefinition.MAX_SIZE_BYTES.getName())) {
      settings.setMaxSizeBytes(
          AddressSettingDefinition.MAX_SIZE_BYTES.resolveModelAttribute(context, config).asLong());
    }
    if (config.hasDefined(AddressSettingDefinition.MESSAGE_COUNTER_HISTORY_DAY_LIMIT.getName())) {
      settings.setMessageCounterHistoryDayLimit(
          AddressSettingDefinition.MESSAGE_COUNTER_HISTORY_DAY_LIMIT
              .resolveModelAttribute(context, config)
              .asInt());
    }
    if (config.hasDefined(CommonAttributes.EXPIRY_ADDRESS.getName())) {
      settings.setExpiryAddress(
          asSimpleString(EXPIRY_ADDRESS.resolveModelAttribute(context, config), null));
    }
    if (config.hasDefined(AddressSettingDefinition.EXPIRY_DELAY.getName())) {
      settings.setExpiryDelay(
          AddressSettingDefinition.EXPIRY_DELAY.resolveModelAttribute(context, config).asLong());
    }
    if (config.hasDefined(AddressSettingDefinition.REDELIVERY_DELAY.getName())) {
      settings.setRedeliveryDelay(
          AddressSettingDefinition.REDELIVERY_DELAY
              .resolveModelAttribute(context, config)
              .asLong());
    }
    if (config.hasDefined(AddressSettingDefinition.REDELIVERY_MULTIPLIER.getName())) {
      settings.setRedeliveryMultiplier(
          AddressSettingDefinition.REDELIVERY_MULTIPLIER
              .resolveModelAttribute(context, config)
              .asDouble());
    }
    if (config.hasDefined(AddressSettingDefinition.MAX_REDELIVERY_DELAY.getName())) {
      settings.setMaxRedeliveryDelay(
          AddressSettingDefinition.MAX_REDELIVERY_DELAY
              .resolveModelAttribute(context, config)
              .asLong());
    }
    if (config.hasDefined(AddressSettingDefinition.REDISTRIBUTION_DELAY.getName())) {
      settings.setRedistributionDelay(
          AddressSettingDefinition.REDISTRIBUTION_DELAY
              .resolveModelAttribute(context, config)
              .asLong());
    }
    if (config.hasDefined(AddressSettingDefinition.PAGE_SIZE_BYTES.getName())) {
      settings.setPageSizeBytes(
          AddressSettingDefinition.PAGE_SIZE_BYTES.resolveModelAttribute(context, config).asLong());
    }
    if (config.hasDefined(AddressSettingDefinition.PAGE_MAX_CACHE_SIZE.getName())) {
      settings.setPageCacheMaxSize(
          AddressSettingDefinition.PAGE_MAX_CACHE_SIZE
              .resolveModelAttribute(context, config)
              .asInt());
    }
    if (config.hasDefined(AddressSettingDefinition.SEND_TO_DLA_ON_NO_ROUTE.getName())) {
      settings.setSendToDLAOnNoRoute(
          AddressSettingDefinition.SEND_TO_DLA_ON_NO_ROUTE
              .resolveModelAttribute(context, config)
              .asBoolean());
    }
    return settings;
  }