/** * Add a new match to the repository * * @param match The regex to use to match against * @param value the value to hold against the match */ @Override public void addMatch(final String match, final T value, final boolean immutableMatch) { addMatch(match, value, immutableMatch, true); }
/** * set the default value to fallback to if none found * * @param defaultValue the value */ @Override public void setDefault(final T defaultValue) { clearCache(); defaultmatch = defaultValue; }
public long getMaxRedeliveryDelay() { // default is redelivery-delay * 10 as specified on the docs and at this JIRA: // https://issues.jboss.org/browse/HORNETQ-1263 return maxRedeliveryDelay != null ? maxRedeliveryDelay : (getRedeliveryDelay() * 10); }
@Override protected void configureAddressSettings(Map<String, AddressSettings> addressSettingsMap) { addressSettingsMap.put("#", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false). setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ")).setAddressFullMessagePolicy(AddressFullMessagePolicy.FAIL).setMaxSizeBytes(10000)); }
final AddressSettings addressSetting = new AddressSettings(); addressSetting.setMaxSizeBytes(10 * 1024 * 1024); // 10 MB addressSetting.setPageSizeBytes(1024 * 1024); // 1 MB server.getPagingManager().getPageStore(new SimpleString(addressName)) .applySetting(addressSetting);
/** * @param addressSettings */ @Override public void applySetting(final AddressSettings addressSettings) { maxSize = addressSettings.getMaxSizeBytes(); pageSize = addressSettings.getPageSizeBytes(); addressFullMessagePolicy = addressSettings.getAddressFullMessagePolicy(); rejectThreshold = addressSettings.getMaxSizeBytesRejectThreshold(); if (cursorProvider != null) { cursorProvider.setCacheMaxSize(addressSettings.getPageCacheMaxSize()); } }
private AddressSettings createAddressSettings() { AddressSettings addressSettings = new AddressSettings(); addressSettings.setRedistributionDelay(0); addressSettings.setDefaultAddressRoutingType(RoutingType.ANYCAST); return addressSettings; }
@Override public void decode(ActiveMQBuffer buffer) { addressMatch = buffer.readSimpleString(); setting = new AddressSettings(); setting.decode(buffer); }
private long calculateRedeliveryDelay(final AddressSettings addressSettings, final int deliveryCount) { long redeliveryDelay = addressSettings.getRedeliveryDelay(); long maxRedeliveryDelay = addressSettings.getMaxRedeliveryDelay(); double redeliveryMultiplier = addressSettings.getRedeliveryMultiplier(); int tmpDeliveryCount = deliveryCount > 0 ? deliveryCount - 1 : 0; long delay = (long) (redeliveryDelay * (Math.pow(redeliveryMultiplier, tmpDeliveryCount))); if (delay > maxRedeliveryDelay) { delay = maxRedeliveryDelay; } return delay; }
@Override protected void extraServerConfig(Configuration serverConfig) { String match = "#"; Map<String, AddressSettings> asMap = serverConfig.getAddressesSettings(); asMap.get(match).setAutoCreateAddresses(true).setAutoCreateQueues(true); }
@Override public PageCursorProvider newCursorProvider(PagingStore store, StorageManager storageManager, AddressSettings addressSettings, ArtemisExecutor executor) { return new PageCursorProviderImpl(store, storageManager, executor, addressSettings.getPageCacheMaxSize()); }
private void configureExpiry(final AddressSettings settings) { this.expiryAddress = settings == null ? null : settings.getExpiryAddress(); }
private static SimpleString lastValueKey(final AddressSettings addressSettings) { if (addressSettings.getDefaultLastValueKey() != null && !addressSettings.getDefaultLastValueKey().isEmpty()) { return addressSettings.getDefaultLastValueKey(); } else if (addressSettings.isDefaultLastValueQueue()) { return Message.HDR_LAST_VALUE_NAME; } else { return null; } }
public HierarchicalObjectRepository(final WildcardConfiguration wildcardConfiguration, final MatchModifier matchModifier) { this.wildcardConfiguration = wildcardConfiguration == null ? DEFAULT_WILDCARD_CONFIGURATION : wildcardConfiguration; this.matchComparator = new MatchComparator(this.wildcardConfiguration); this.matchModifier = matchModifier; }
@Override public void encode(ActiveMQBuffer buffer) { buffer.writeSimpleString(addressMatch); setting.encode(buffer); }
@Override public int getEncodeSize() { return addressMatch.sizeof() + setting.getEncodeSize(); }
@Override public PageCursorProvider newCursorProvider(PagingStore store, StorageManager storageManager, AddressSettings addressSettings, ArtemisExecutor executor) { return new PageCursorProviderImpl(store, storageManager, executor, addressSettings.getPageCacheMaxSize()); }
@Override public void addMatch(final String match, final T value) { addMatch(match, value, false); }
@Override public PageCursorProvider newCursorProvider(PagingStore store, StorageManager storageManager, AddressSettings addressSettings, ArtemisExecutor executor) { return new PageCursorProviderImpl(store, storageManager, executor, addressSettings.getPageCacheMaxSize()); }