You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by "andytaylor (via GitHub)" <gi...@apache.org> on 2023/08/23 12:29:29 UTC
[GitHub] [activemq-artemis] andytaylor opened a new pull request, #4587: ARTEMIS-4398 - support configuring database using Broker Properties
andytaylor opened a new pull request, #4587:
URL: https://github.com/apache/activemq-artemis/pull/4587
https://issues.apache.org/jira/browse/ARTEMIS-4398
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [activemq-artemis] andytaylor commented on a diff in pull request #4587: ARTEMIS-4398 - support configuring database using Broker Properties
Posted by "andytaylor (via GitHub)" <gi...@apache.org>.
andytaylor commented on code in PR #4587:
URL: https://github.com/apache/activemq-artemis/pull/4587#discussion_r1308388676
##########
artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java:
##########
@@ -1554,6 +1555,48 @@ public void testSystemPropKeyReplacement() throws Exception {
}
}
+ @Test
+ public void testDatabaseStoreConfigurationProps() throws Exception {
+ ConfigurationImpl configuration = new ConfigurationImpl();
+ Properties insertionOrderedProperties = new ConfigurationImpl.InsertionOrderedProperties();
+ insertionOrderedProperties.put("storeConfiguration", "DATABASE");
+ insertionOrderedProperties.put("storeConfiguration.largeMessageTableName", "lmtn");
+ insertionOrderedProperties.put("storeConfiguration.messageTableName", "mtn");
+ insertionOrderedProperties.put("storeConfiguration.bindingsTableName", "btn");
+ insertionOrderedProperties.put("storeConfiguration.dataSourceClassName", "dscn");
+ insertionOrderedProperties.put("storeConfiguration.nodeManagerStoreTableName", "nmtn");
+ insertionOrderedProperties.put("storeConfiguration.pageStoreTableName", "pstn");
+ insertionOrderedProperties.put("storeConfiguration.jdbcAllowedTimeDiff", 123);
+ insertionOrderedProperties.put("storeConfiguration.jdbcConnectionUrl", "url");
+ insertionOrderedProperties.put("storeConfiguration.jdbcDriverClassName", "dcn");
+ insertionOrderedProperties.put("storeConfiguration.jdbcJournalSyncPeriodMillis", 456);
+ insertionOrderedProperties.put("storeConfiguration.jdbcLockAcquisitionTimeoutMillis", 789);
+ insertionOrderedProperties.put("storeConfiguration.jdbcLockExpirationMillis", 321);
+ insertionOrderedProperties.put("storeConfiguration.jdbcLockRenewPeriodMillis", 654);
+ insertionOrderedProperties.put("storeConfiguration.jdbcNetworkTimeout", 987);
+ insertionOrderedProperties.put("storeConfiguration.jdbcPassword", "pass");
+ insertionOrderedProperties.put("storeConfiguration.jdbcUser", "user");
+ configuration.parsePrefixedProperties(insertionOrderedProperties, null);
+ Assert.assertTrue(configuration.getStoreConfiguration() instanceof DatabaseStorageConfiguration);
+ DatabaseStorageConfiguration dsc = (DatabaseStorageConfiguration) configuration.getStoreConfiguration();
+ Assert.assertEquals(dsc.getLargeMessageTableName(), "lmtn");
+ Assert.assertEquals(dsc.getMessageTableName(), "mtn");
+ Assert.assertEquals(dsc.getBindingsTableName(), "btn");
+ Assert.assertEquals(dsc.getDataSourceClassName(), "dscn");
+ Assert.assertEquals(dsc.getJdbcAllowedTimeDiff(), 123);
+ Assert.assertEquals(dsc.getJdbcConnectionUrl(), "url");
+ Assert.assertEquals(dsc.getJdbcDriverClassName(), "dcn");
+ Assert.assertEquals(dsc.getJdbcJournalSyncPeriodMillis(), 456);
+ Assert.assertEquals(dsc.getJdbcLockAcquisitionTimeoutMillis(), 789);
+ Assert.assertEquals(dsc.getJdbcLockExpirationMillis(), 321);
+ Assert.assertEquals(dsc.getJdbcLockRenewPeriodMillis(), 654);
+ Assert.assertEquals(dsc.getJdbcNetworkTimeout(), 987);
+ Assert.assertEquals(dsc.getJdbcPassword(), "pass");
+ Assert.assertEquals(dsc.getJdbcUser(), "user");
+ Assert.assertEquals(dsc.getNodeManagerStoreTableName(), "nmtn");
+ Assert.assertEquals(dsc.getPageStoreTableName(), "pstn");
+ }
+
@Test
Review Comment:
Negative test added as well
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [activemq-artemis] gtully commented on a diff in pull request #4587: ARTEMIS-4398 - support configuring database using Broker Properties
Posted by "gtully (via GitHub)" <gi...@apache.org>.
gtully commented on code in PR #4587:
URL: https://github.com/apache/activemq-artemis/pull/4587#discussion_r1302971542
##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java:
##########
@@ -773,6 +774,17 @@ public <T> T convert(Class<T> type, Object value) {
}
}, TransformerConfiguration.class);
+ beanUtils.getConvertUtils().register(new Converter() {
+ @Override
+ public <T> T convert(Class<T> type, Object value) {
+ //we only care about DATABASE type as it is the only one used
+ if (StoreConfiguration.StoreType.DATABASE.toString().equals(value)) {
+ return (T) new DatabaseStorageConfiguration();
+ }
+ return (T) null;
Review Comment:
I think throw some runtimeexception here - value must be DATABASE, otherwise the error on the next set will be hard to debug
##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java:
##########
@@ -80,6 +80,7 @@
import org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration;
import org.apache.activemq.artemis.core.config.routing.NamedPropertyConfiguration;
import org.apache.activemq.artemis.core.config.storage.DatabaseStorageConfiguration;
+import org.apache.activemq.artemis.core.config.storage.FileStorageConfiguration;
Review Comment:
that looks unused
##########
artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java:
##########
@@ -1554,6 +1555,48 @@ public void testSystemPropKeyReplacement() throws Exception {
}
}
+ @Test
+ public void testDatabaseStoreConfigurationProps() throws Exception {
+ ConfigurationImpl configuration = new ConfigurationImpl();
+ Properties insertionOrderedProperties = new ConfigurationImpl.InsertionOrderedProperties();
+ insertionOrderedProperties.put("storeConfiguration", "DATABASE");
+ insertionOrderedProperties.put("storeConfiguration.largeMessageTableName", "lmtn");
+ insertionOrderedProperties.put("storeConfiguration.messageTableName", "mtn");
+ insertionOrderedProperties.put("storeConfiguration.bindingsTableName", "btn");
+ insertionOrderedProperties.put("storeConfiguration.dataSourceClassName", "dscn");
+ insertionOrderedProperties.put("storeConfiguration.nodeManagerStoreTableName", "nmtn");
+ insertionOrderedProperties.put("storeConfiguration.pageStoreTableName", "pstn");
+ insertionOrderedProperties.put("storeConfiguration.jdbcAllowedTimeDiff", 123);
+ insertionOrderedProperties.put("storeConfiguration.jdbcConnectionUrl", "url");
+ insertionOrderedProperties.put("storeConfiguration.jdbcDriverClassName", "dcn");
+ insertionOrderedProperties.put("storeConfiguration.jdbcJournalSyncPeriodMillis", 456);
+ insertionOrderedProperties.put("storeConfiguration.jdbcLockAcquisitionTimeoutMillis", 789);
+ insertionOrderedProperties.put("storeConfiguration.jdbcLockExpirationMillis", 321);
+ insertionOrderedProperties.put("storeConfiguration.jdbcLockRenewPeriodMillis", 654);
+ insertionOrderedProperties.put("storeConfiguration.jdbcNetworkTimeout", 987);
+ insertionOrderedProperties.put("storeConfiguration.jdbcPassword", "pass");
+ insertionOrderedProperties.put("storeConfiguration.jdbcUser", "user");
+ configuration.parsePrefixedProperties(insertionOrderedProperties, null);
+ Assert.assertTrue(configuration.getStoreConfiguration() instanceof DatabaseStorageConfiguration);
+ DatabaseStorageConfiguration dsc = (DatabaseStorageConfiguration) configuration.getStoreConfiguration();
+ Assert.assertEquals(dsc.getLargeMessageTableName(), "lmtn");
+ Assert.assertEquals(dsc.getMessageTableName(), "mtn");
+ Assert.assertEquals(dsc.getBindingsTableName(), "btn");
+ Assert.assertEquals(dsc.getDataSourceClassName(), "dscn");
+ Assert.assertEquals(dsc.getJdbcAllowedTimeDiff(), 123);
+ Assert.assertEquals(dsc.getJdbcConnectionUrl(), "url");
+ Assert.assertEquals(dsc.getJdbcDriverClassName(), "dcn");
+ Assert.assertEquals(dsc.getJdbcJournalSyncPeriodMillis(), 456);
+ Assert.assertEquals(dsc.getJdbcLockAcquisitionTimeoutMillis(), 789);
+ Assert.assertEquals(dsc.getJdbcLockExpirationMillis(), 321);
+ Assert.assertEquals(dsc.getJdbcLockRenewPeriodMillis(), 654);
+ Assert.assertEquals(dsc.getJdbcNetworkTimeout(), 987);
+ Assert.assertEquals(dsc.getJdbcPassword(), "pass");
+ Assert.assertEquals(dsc.getJdbcUser(), "user");
+ Assert.assertEquals(dsc.getNodeManagerStoreTableName(), "nmtn");
+ Assert.assertEquals(dsc.getPageStoreTableName(), "pstn");
+ }
+
@Test
Review Comment:
a negative test where the value is wrong would be great. to see what error comes out. the error should be in the Status.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [activemq-artemis] gtully merged pull request #4587: ARTEMIS-4398 - support configuring database using Broker Properties
Posted by "gtully (via GitHub)" <gi...@apache.org>.
gtully merged PR #4587:
URL: https://github.com/apache/activemq-artemis/pull/4587
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [activemq-artemis] andytaylor commented on a diff in pull request #4587: ARTEMIS-4398 - support configuring database using Broker Properties
Posted by "andytaylor (via GitHub)" <gi...@apache.org>.
andytaylor commented on code in PR #4587:
URL: https://github.com/apache/activemq-artemis/pull/4587#discussion_r1308388409
##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java:
##########
@@ -773,6 +774,17 @@ public <T> T convert(Class<T> type, Object value) {
}
}, TransformerConfiguration.class);
+ beanUtils.getConvertUtils().register(new Converter() {
+ @Override
+ public <T> T convert(Class<T> type, Object value) {
+ //we only care about DATABASE type as it is the only one used
+ if (StoreConfiguration.StoreType.DATABASE.toString().equals(value)) {
+ return (T) new DatabaseStorageConfiguration();
+ }
+ return (T) null;
Review Comment:
Ive changed this
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org