diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/bean/MetaBean.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/bean/MetaBean.java index 5a92ca1234..70bb0b16e7 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/bean/MetaBean.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/bean/MetaBean.java @@ -36,8 +36,8 @@ import org.slf4j.LoggerFactory; * Receives a metadata about a class with methods to read, write and certain gates. * And provides a generic logic to convert to and from JSON. *

- * As a historical context the first try to make a few objects more dynamic (e.g AddressSettings) was - * around BeanUtils however there was some implicit logic on when certain settins were Null or default values. + * As a historical context the first try to make a few objects more dynamic (e.g. AddressSettings) was + * around BeanUtils however there was some implicit logic on when certain settings were Null or default values. * for that reason I decided for a meta-data approach where extra semantic could be applied for each individual attributes * rather than a generic BeanUtils parser. */ diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java index dc5323e838..9169c91d99 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java @@ -87,7 +87,6 @@ import org.apache.activemq.artemis.core.management.impl.view.SessionView; import org.apache.activemq.artemis.core.messagecounter.MessageCounterManager; import org.apache.activemq.artemis.core.messagecounter.impl.MessageCounterManagerImpl; import org.apache.activemq.artemis.core.persistence.StorageManager; -import org.apache.activemq.artemis.core.persistence.config.PersistedAddressSetting; import org.apache.activemq.artemis.core.persistence.config.PersistedAddressSettingJSON; import org.apache.activemq.artemis.core.persistence.config.PersistedConnector; import org.apache.activemq.artemis.core.persistence.config.PersistedSecuritySetting; @@ -3530,7 +3529,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active server.getAddressSettingsRepository().addMatch(address, addressSettings); - storageManager.storeAddressSetting(new PersistedAddressSetting(new SimpleString(address), addressSettings)); + storageManager.storeAddressSetting(new PersistedAddressSettingJSON(new SimpleString(address), addressSettings, addressSettings.toJSON())); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/StorageManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/StorageManager.java index e2582fba7c..4644d6832d 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/StorageManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/StorageManager.java @@ -41,7 +41,6 @@ import org.apache.activemq.artemis.core.paging.PagingManager; import org.apache.activemq.artemis.core.paging.PagingStore; import org.apache.activemq.artemis.core.paging.cursor.PagePosition; import org.apache.activemq.artemis.core.persistence.config.AbstractPersistedAddressSetting; -import org.apache.activemq.artemis.core.persistence.config.PersistedAddressSetting; import org.apache.activemq.artemis.core.persistence.config.PersistedAddressSettingJSON; import org.apache.activemq.artemis.core.persistence.config.PersistedBridgeConfiguration; import org.apache.activemq.artemis.core.persistence.config.PersistedConnector; @@ -367,8 +366,6 @@ public interface StorageManager extends IDGenerator, ActiveMQComponent { void deleteGrouping(long tx, GroupBinding groupBinding) throws Exception; - void storeAddressSetting(PersistedAddressSetting addressSetting) throws Exception; - void storeAddressSetting(PersistedAddressSettingJSON addressSetting) throws Exception; void deleteAddressSetting(SimpleString addressMatch) throws Exception; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/config/PersistedAddressSetting.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/config/PersistedAddressSetting.java index 194b3f9dac..3ca3f507af 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/config/PersistedAddressSetting.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/config/PersistedAddressSetting.java @@ -17,10 +17,14 @@ package org.apache.activemq.artemis.core.persistence.config; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; -import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.journal.EncodingSupport; import org.apache.activemq.artemis.core.settings.impl.AddressSettings; +/** + * This class is only kept for compatibility reasons. The encode method should be dead code at this point and + * only the decode should be used when versioning is at play. + * @Deprecated Use PersistedAddressSettingJSON instead + */ public class PersistedAddressSetting extends AbstractPersistedAddressSetting implements EncodingSupport { @@ -41,14 +45,6 @@ public class PersistedAddressSetting extends AbstractPersistedAddressSetting imp "]"; } - /** - * @param addressMatch - * @param setting - */ - public PersistedAddressSetting(SimpleString addressMatch, AddressSettings setting) { - super(addressMatch, setting); - } - @Override public void decode(ActiveMQBuffer buffer) { addressMatch = buffer.readSimpleString(); @@ -59,9 +55,8 @@ public class PersistedAddressSetting extends AbstractPersistedAddressSetting imp @Override public void encode(ActiveMQBuffer buffer) { - buffer.writeSimpleString(addressMatch); - - setting.encode(buffer); + // no encode, this class is supposed to be for compatibility and reading old records only. + throw new UnsupportedOperationException("PersistedAddressSetting should not be in use. Use PersistedAddressSettingJSON instead"); } @Override diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/config/PersistedAddressSettingJSON.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/config/PersistedAddressSettingJSON.java index b7c4fce651..40aec90159 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/config/PersistedAddressSettingJSON.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/config/PersistedAddressSettingJSON.java @@ -46,6 +46,10 @@ public class PersistedAddressSettingJSON extends AbstractPersistedAddressSetting this.jsonSetting = jsonSetting; } + public PersistedAddressSettingJSON(SimpleString addressMatch, AddressSettings setting, String jsonSetting) { + this(addressMatch, setting, SimpleString.toSimpleString(jsonSetting)); + } + @Override public void decode(ActiveMQBuffer buffer) { addressMatch = buffer.readSimpleString(); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java index 8bd9867913..61b2db6150 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java @@ -731,18 +731,6 @@ public abstract class AbstractJournalStorageManager extends CriticalComponentImp messageJournal.tryAppendUpdateRecord(ref.getMessage().getMessageID(), JournalRecordIds.UPDATE_DELIVERY_COUNT, updateInfo, syncNonTransactional, true, this::messageUpdateCallback, getContext(syncNonTransactional)); } } - - @Override - public void storeAddressSetting(PersistedAddressSetting addressSetting) throws Exception { - deleteAddressSetting(addressSetting.getAddressMatch()); - try (ArtemisCloseable lock = closeableReadLock()) { - long id = idGenerator.generateID(); - addressSetting.setStoreId(id); - bindingsJournal.appendAddRecord(id, JournalRecordIds.ADDRESS_SETTING_RECORD, addressSetting, true); - mapPersistedAddressSettings.put(addressSetting.getAddressMatch(), addressSetting); - } - } - @Override public void storeAddressSetting(PersistedAddressSettingJSON addressSetting) throws Exception { deleteAddressSetting(addressSetting.getAddressMatch()); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/nullpm/NullStorageManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/nullpm/NullStorageManager.java index 4f62de0bbe..366f3040d9 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/nullpm/NullStorageManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/nullpm/NullStorageManager.java @@ -49,7 +49,6 @@ import org.apache.activemq.artemis.core.persistence.QueueBindingInfo; import org.apache.activemq.artemis.core.persistence.AddressQueueStatus; import org.apache.activemq.artemis.core.persistence.StorageManager; import org.apache.activemq.artemis.core.persistence.config.AbstractPersistedAddressSetting; -import org.apache.activemq.artemis.core.persistence.config.PersistedAddressSetting; import org.apache.activemq.artemis.core.persistence.config.PersistedAddressSettingJSON; import org.apache.activemq.artemis.core.persistence.config.PersistedBridgeConfiguration; import org.apache.activemq.artemis.core.persistence.config.PersistedConnector; @@ -461,10 +460,6 @@ public class NullStorageManager implements StorageManager { return Collections.emptyList(); } - @Override - public void storeAddressSetting(final PersistedAddressSetting addressSetting) throws Exception { - } - @Override public void storeAddressSetting(final PersistedAddressSettingJSON addressSetting) throws Exception { } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/AddressSettings.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/AddressSettings.java index bbbc74289d..cf34b1b86b 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/AddressSettings.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/AddressSettings.java @@ -28,7 +28,6 @@ import org.apache.activemq.artemis.core.journal.EncodingSupport; import org.apache.activemq.artemis.core.settings.Mergeable; import org.apache.activemq.artemis.utils.bean.MetaBean; import org.apache.activemq.artemis.utils.BufferHelper; -import org.apache.activemq.artemis.utils.DataConstants; /** * Configuration settings that are applied on the address level @@ -1601,240 +1600,23 @@ public class AddressSettings implements Mergeable, Serializable if (buffer.readableBytes() > 0) { prefetchPageMessages = BufferHelper.readNullableInteger(buffer); } + + // WARNING: no more additions, this method is deprecated, any current persist usage should be in JSON format + // This method serves the purpose of loading older records, but any new records should be on the new format } @Override public int getEncodeSize() { + ////// this method is no longer in use, any new usage of encoding an AddressSetting should be through its JSON format - return BufferHelper.sizeOfNullableSimpleString(addressFullMessagePolicy != null ? addressFullMessagePolicy.toString() : null) + - BufferHelper.sizeOfNullableLong(maxSizeBytes) + - BufferHelper.sizeOfNullableLong(pageSizeBytes == null ? null : Long.valueOf(pageSizeBytes)) + - BufferHelper.sizeOfNullableInteger(pageCacheMaxSize) + - BufferHelper.sizeOfNullableBoolean(dropMessagesWhenFull) + - BufferHelper.sizeOfNullableInteger(maxDeliveryAttempts) + - BufferHelper.sizeOfNullableInteger(messageCounterHistoryDayLimit) + - BufferHelper.sizeOfNullableLong(redeliveryDelay) + - BufferHelper.sizeOfNullableDouble(redeliveryMultiplier) + - BufferHelper.sizeOfNullableDouble(redeliveryCollisionAvoidanceFactor) + - BufferHelper.sizeOfNullableLong(maxRedeliveryDelay) + - SimpleString.sizeofNullableString(deadLetterAddress) + - SimpleString.sizeofNullableString(expiryAddress) + - BufferHelper.sizeOfNullableLong(expiryDelay) + - BufferHelper.sizeOfNullableLong(minExpiryDelay) + - BufferHelper.sizeOfNullableLong(maxExpiryDelay) + - BufferHelper.sizeOfNullableBoolean(defaultLastValueQueue) + - BufferHelper.sizeOfNullableLong(redistributionDelay) + - BufferHelper.sizeOfNullableBoolean(sendToDLAOnNoRoute) + - BufferHelper.sizeOfNullableLong(slowConsumerCheckPeriod) + - BufferHelper.sizeOfNullableLong(slowConsumerThreshold) + - BufferHelper.sizeOfNullableSimpleString(slowConsumerPolicy != null ? slowConsumerPolicy.toString() : null) + - BufferHelper.sizeOfNullableBoolean(autoCreateJmsQueues) + - BufferHelper.sizeOfNullableBoolean(autoDeleteJmsQueues) + - BufferHelper.sizeOfNullableBoolean(autoCreateJmsTopics) + - BufferHelper.sizeOfNullableBoolean(autoDeleteJmsTopics) + - BufferHelper.sizeOfNullableBoolean(autoCreateQueues) + - BufferHelper.sizeOfNullableBoolean(autoDeleteQueues) + BufferHelper.sizeOfNullableSimpleString(configDeleteQueues != null ? configDeleteQueues.toString() : null) + - BufferHelper.sizeOfNullableBoolean(autoCreateAddresses) + - BufferHelper.sizeOfNullableBoolean(autoDeleteAddresses) + BufferHelper.sizeOfNullableSimpleString(configDeleteAddresses != null ? configDeleteAddresses.toString() : null) + - BufferHelper.sizeOfNullableSimpleString(configDeleteDiverts != null ? configDeleteDiverts.toString() : null) + - BufferHelper.sizeOfNullableInteger(managementBrowsePageSize) + - BufferHelper.sizeOfNullableLong(maxSizeBytesRejectThreshold) + - BufferHelper.sizeOfNullableInteger(defaultMaxConsumers) + - BufferHelper.sizeOfNullableBoolean(defaultPurgeOnNoConsumers) + - DataConstants.SIZE_BYTE + - DataConstants.SIZE_BYTE + - BufferHelper.sizeOfNullableBoolean(defaultExclusiveQueue) + - BufferHelper.sizeOfNullableInteger(defaultConsumersBeforeDispatch) + - BufferHelper.sizeOfNullableLong(defaultDelayBeforeDispatch) + - BufferHelper.sizeOfNullableInteger(defaultConsumerWindowSize) + - SimpleString.sizeofNullableString(defaultLastValueKey) + - BufferHelper.sizeOfNullableBoolean(defaultNonDestructive) + - BufferHelper.sizeOfNullableLong(autoDeleteQueuesDelay) + - BufferHelper.sizeOfNullableBoolean(autoDeleteQueuesSkipUsageCheck) + - BufferHelper.sizeOfNullableLong(autoDeleteAddressesDelay) + - BufferHelper.sizeOfNullableBoolean(autoDeleteAddressesSkipUsageCheck) + - BufferHelper.sizeOfNullableBoolean(defaultGroupRebalance) + - BufferHelper.sizeOfNullableInteger(defaultGroupBuckets) + - SimpleString.sizeofNullableString(defaultGroupFirstKey) + - BufferHelper.sizeOfNullableLong(autoDeleteQueuesMessageCount) + - BufferHelper.sizeOfNullableBoolean(autoDeleteCreatedQueues) + - BufferHelper.sizeOfNullableLong(defaultRingSize) + - BufferHelper.sizeOfNullableLong(retroactiveMessageCount) + - BufferHelper.sizeOfNullableBoolean(autoCreateDeadLetterResources) + - SimpleString.sizeofNullableString(deadLetterQueuePrefix) + - SimpleString.sizeofNullableString(deadLetterQueueSuffix) + - BufferHelper.sizeOfNullableBoolean(autoCreateExpiryResources) + - SimpleString.sizeofNullableString(expiryQueuePrefix) + - SimpleString.sizeofNullableString(expiryQueueSuffix) + - BufferHelper.sizeOfNullableBoolean(enableMetrics) + - BufferHelper.sizeOfNullableBoolean(defaultGroupRebalancePauseDispatch) + - BufferHelper.sizeOfNullableInteger(managementMessageAttributeSizeLimit) + - BufferHelper.sizeOfNullableInteger(slowConsumerThresholdMeasurementUnit.getValue()) + - BufferHelper.sizeOfNullableBoolean(enableIngressTimestamp) + - BufferHelper.sizeOfNullableLong(maxSizeMessages) + - BufferHelper.sizeOfNullableInteger(maxReadPageMessages) + - BufferHelper.sizeOfNullableInteger(maxReadPageBytes) + - BufferHelper.sizeOfNullableLong(pageLimitBytes) + - BufferHelper.sizeOfNullableLong(pageLimitMessages) + - BufferHelper.sizeOfNullableInteger(idCacheSize) + - BufferHelper.sizeOfNullableSimpleString(pageFullMessagePolicy != null ? pageFullMessagePolicy.toString() : null) + - BufferHelper.sizeOfNullableInteger(prefetchPageBytes) + - BufferHelper.sizeOfNullableInteger(prefetchPageMessages); + throw new UnsupportedOperationException("Encode of AddressSettings is no longer supported, please use JSON method and PersistAddressSettingJSON"); } @Override public void encode(ActiveMQBuffer buffer) { - buffer.writeNullableSimpleString(addressFullMessagePolicy != null ? new SimpleString(addressFullMessagePolicy.toString()) : null); + ////// this method is no longer in use, any new usage of encoding an AddressSetting should be through its JSON format - BufferHelper.writeNullableLong(buffer, maxSizeBytes); - - BufferHelper.writeNullableLong(buffer, pageSizeBytes == null ? null : Long.valueOf(pageSizeBytes)); - - BufferHelper.writeNullableInteger(buffer, pageCacheMaxSize); - - BufferHelper.writeNullableBoolean(buffer, dropMessagesWhenFull); - - BufferHelper.writeNullableInteger(buffer, maxDeliveryAttempts); - - BufferHelper.writeNullableInteger(buffer, messageCounterHistoryDayLimit); - - BufferHelper.writeNullableLong(buffer, redeliveryDelay); - - BufferHelper.writeNullableDouble(buffer, redeliveryMultiplier); - - BufferHelper.writeNullableLong(buffer, maxRedeliveryDelay); - - buffer.writeNullableSimpleString(deadLetterAddress); - - buffer.writeNullableSimpleString(expiryAddress); - - BufferHelper.writeNullableLong(buffer, expiryDelay); - - BufferHelper.writeNullableBoolean(buffer, defaultLastValueQueue); - - BufferHelper.writeNullableLong(buffer, redistributionDelay); - - BufferHelper.writeNullableBoolean(buffer, sendToDLAOnNoRoute); - - BufferHelper.writeNullableLong(buffer, slowConsumerThreshold); - - BufferHelper.writeNullableLong(buffer, slowConsumerCheckPeriod); - - buffer.writeNullableSimpleString(slowConsumerPolicy != null ? new SimpleString(slowConsumerPolicy.toString()) : null); - - BufferHelper.writeNullableBoolean(buffer, autoCreateJmsQueues); - - BufferHelper.writeNullableBoolean(buffer, autoDeleteJmsQueues); - - BufferHelper.writeNullableBoolean(buffer, autoCreateJmsTopics); - - BufferHelper.writeNullableBoolean(buffer, autoDeleteJmsTopics); - - BufferHelper.writeNullableBoolean(buffer, autoCreateQueues); - - BufferHelper.writeNullableBoolean(buffer, autoDeleteQueues); - - buffer.writeNullableSimpleString(configDeleteQueues != null ? new SimpleString(configDeleteQueues.toString()) : null); - - BufferHelper.writeNullableBoolean(buffer, autoCreateAddresses); - - BufferHelper.writeNullableBoolean(buffer, autoDeleteAddresses); - - buffer.writeNullableSimpleString(configDeleteAddresses != null ? new SimpleString(configDeleteAddresses.toString()) : null); - - BufferHelper.writeNullableInteger(buffer, managementBrowsePageSize); - - BufferHelper.writeNullableLong(buffer, maxSizeBytesRejectThreshold); - - BufferHelper.writeNullableInteger(buffer, defaultMaxConsumers); - - BufferHelper.writeNullableBoolean(buffer, defaultPurgeOnNoConsumers); - - buffer.writeByte(defaultQueueRoutingType == null ? -1 : defaultQueueRoutingType.getType()); - - buffer.writeByte(defaultAddressRoutingType == null ? -1 : defaultAddressRoutingType.getType()); - - BufferHelper.writeNullableBoolean(buffer, defaultExclusiveQueue); - - BufferHelper.writeNullableInteger(buffer, defaultConsumersBeforeDispatch); - - BufferHelper.writeNullableLong(buffer, defaultDelayBeforeDispatch); - - BufferHelper.writeNullableInteger(buffer, defaultConsumerWindowSize); - - buffer.writeNullableSimpleString(defaultLastValueKey); - - BufferHelper.writeNullableBoolean(buffer, defaultNonDestructive); - - BufferHelper.writeNullableLong(buffer, autoDeleteQueuesDelay); - - BufferHelper.writeNullableLong(buffer, autoDeleteAddressesDelay); - - BufferHelper.writeNullableBoolean(buffer, defaultGroupRebalance); - - BufferHelper.writeNullableInteger(buffer, defaultGroupBuckets); - - BufferHelper.writeNullableLong(buffer, autoDeleteQueuesMessageCount); - - BufferHelper.writeNullableBoolean(buffer, autoDeleteCreatedQueues); - - BufferHelper.writeNullableLong(buffer, defaultRingSize); - - BufferHelper.writeNullableDouble(buffer, redeliveryCollisionAvoidanceFactor); - - buffer.writeNullableSimpleString(defaultGroupFirstKey); - - BufferHelper.writeNullableLong(buffer, retroactiveMessageCount); - - BufferHelper.writeNullableBoolean(buffer, autoCreateDeadLetterResources); - - buffer.writeNullableSimpleString(deadLetterQueuePrefix); - - buffer.writeNullableSimpleString(deadLetterQueueSuffix); - - BufferHelper.writeNullableBoolean(buffer, autoCreateExpiryResources); - - buffer.writeNullableSimpleString(expiryQueuePrefix); - - buffer.writeNullableSimpleString(expiryQueueSuffix); - - BufferHelper.writeNullableLong(buffer, minExpiryDelay); - - BufferHelper.writeNullableLong(buffer, maxExpiryDelay); - - BufferHelper.writeNullableBoolean(buffer, enableMetrics); - - BufferHelper.writeNullableBoolean(buffer, defaultGroupRebalancePauseDispatch); - - BufferHelper.writeNullableInteger(buffer, managementMessageAttributeSizeLimit); - - BufferHelper.writeNullableInteger(buffer, slowConsumerThresholdMeasurementUnit == null ? null : slowConsumerThresholdMeasurementUnit.getValue()); - - BufferHelper.writeNullableBoolean(buffer, enableIngressTimestamp); - - buffer.writeNullableSimpleString(configDeleteDiverts != null ? new SimpleString(configDeleteDiverts.toString()) : null); - - BufferHelper.writeNullableLong(buffer, maxSizeMessages); - - BufferHelper.writeNullableInteger(buffer, maxReadPageBytes); - - BufferHelper.writeNullableInteger(buffer, maxReadPageMessages); - - BufferHelper.writeNullableLong(buffer, pageLimitBytes); - - BufferHelper.writeNullableLong(buffer, pageLimitMessages); - - buffer.writeNullableSimpleString(pageFullMessagePolicy != null ? new SimpleString(pageFullMessagePolicy.toString()) : null); - - BufferHelper.writeNullableBoolean(buffer, autoDeleteQueuesSkipUsageCheck); - - BufferHelper.writeNullableBoolean(buffer, autoDeleteAddressesSkipUsageCheck); - - BufferHelper.writeNullableInteger(buffer, idCacheSize); - - BufferHelper.writeNullableInteger(buffer, prefetchPageBytes); - - BufferHelper.writeNullableInteger(buffer, prefetchPageMessages); + throw new UnsupportedOperationException("Encode of AddressSettings is no longer supported, please use JSON method and PersistAddressSettingJSON"); } @Override diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/transaction/impl/TransactionImplTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/transaction/impl/TransactionImplTest.java index 6b0c3005f6..e486690b17 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/transaction/impl/TransactionImplTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/transaction/impl/TransactionImplTest.java @@ -46,7 +46,6 @@ import org.apache.activemq.artemis.core.persistence.OperationContext; import org.apache.activemq.artemis.core.persistence.QueueBindingInfo; import org.apache.activemq.artemis.core.persistence.StorageManager; import org.apache.activemq.artemis.core.persistence.config.AbstractPersistedAddressSetting; -import org.apache.activemq.artemis.core.persistence.config.PersistedAddressSetting; import org.apache.activemq.artemis.core.persistence.config.PersistedAddressSettingJSON; import org.apache.activemq.artemis.core.persistence.config.PersistedBridgeConfiguration; import org.apache.activemq.artemis.core.persistence.config.PersistedConnector; @@ -704,11 +703,6 @@ public class TransactionImplTest extends ServerTestBase { } - @Override - public void storeAddressSetting(PersistedAddressSetting addressSetting) throws Exception { - - } - @Override public void deleteAddressSetting(SimpleString addressMatch) throws Exception { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SendAckFailTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SendAckFailTest.java index 3769b00b23..41904d7c8b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SendAckFailTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SendAckFailTest.java @@ -63,7 +63,6 @@ import org.apache.activemq.artemis.core.persistence.QueueBindingInfo; import org.apache.activemq.artemis.core.persistence.AddressQueueStatus; import org.apache.activemq.artemis.core.persistence.StorageManager; import org.apache.activemq.artemis.core.persistence.config.AbstractPersistedAddressSetting; -import org.apache.activemq.artemis.core.persistence.config.PersistedAddressSetting; import org.apache.activemq.artemis.core.persistence.config.PersistedAddressSettingJSON; import org.apache.activemq.artemis.core.persistence.config.PersistedBridgeConfiguration; import org.apache.activemq.artemis.core.persistence.config.PersistedConnector; @@ -688,11 +687,6 @@ public class SendAckFailTest extends SpawnedTestBase { manager.deleteGrouping(tx, groupBinding); } - @Override - public void storeAddressSetting(PersistedAddressSetting addressSetting) throws Exception { - manager.storeAddressSetting(addressSetting); - } - @Override public void deleteAddressSetting(SimpleString addressMatch) throws Exception { manager.deleteAddressSetting(addressMatch); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/AddressSettingsConfigurationStorageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/AddressSettingsConfigurationStorageTest.java index f6f0304503..02c1f8e6f9 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/AddressSettingsConfigurationStorageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/AddressSettingsConfigurationStorageTest.java @@ -24,7 +24,7 @@ import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.config.StoreConfiguration; import org.apache.activemq.artemis.core.persistence.StorageManager; import org.apache.activemq.artemis.core.persistence.config.AbstractPersistedAddressSetting; -import org.apache.activemq.artemis.core.persistence.config.PersistedAddressSetting; +import org.apache.activemq.artemis.core.persistence.config.PersistedAddressSettingJSON; import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy; import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.settings.impl.DeletionPolicy; @@ -36,7 +36,7 @@ import org.junit.runners.Parameterized; @RunWith(Parameterized.class) public class AddressSettingsConfigurationStorageTest extends StorageManagerTestBase { - private Map mapExpectedAddresses; + private Map mapExpectedAddresses; public AddressSettingsConfigurationStorageTest(StoreConfiguration.StoreType storeType) { super(storeType); @@ -52,7 +52,7 @@ public class AddressSettingsConfigurationStorageTest extends StorageManagerTestB protected void addAddress(StorageManager journal1, String address, AddressSettings setting) throws Exception { SimpleString str = new SimpleString(address); - PersistedAddressSetting persistedSetting = new PersistedAddressSetting(str, setting); + PersistedAddressSettingJSON persistedSetting = new PersistedAddressSettingJSON(str, setting, setting.toJSON()); mapExpectedAddresses.put(str, persistedSetting); journal1.storeAddressSetting(persistedSetting); } @@ -123,7 +123,7 @@ public class AddressSettingsConfigurationStorageTest extends StorageManagerTestB assertEquals(mapExpectedAddresses.size(), listSetting.size()); for (AbstractPersistedAddressSetting el : listSetting) { - PersistedAddressSetting el2 = mapExpectedAddresses.get(el.getAddressMatch()); + PersistedAddressSettingJSON el2 = mapExpectedAddresses.get(el.getAddressMatch()); assertEquals(el.getAddressMatch(), el2.getAddressMatch()); assertEquals(el.getSetting(), el2.getSetting());