ARTEMIS-1774 Node Manager Store table name should be configurable

It exposes the table name configuration for:
- CLI command
- configuration file

The docs are updated as well.
This commit is contained in:
Francesco Nigro 2018-03-28 17:07:04 +02:00 committed by Clebert Suconic
parent ab808106fc
commit 1a7a2cf5b4
6 changed files with 36 additions and 2 deletions

View File

@ -278,9 +278,12 @@ public class Create extends InputAbstract {
@Option(name = "--jdbc-large-message-table-name", description = "Name of the large messages table")
private String jdbcLargeMessages = ActiveMQDefaultConfiguration.getDefaultLargeMessagesTableName();
@Option(name = "--jdbc-page-store-table-name", description = "Name of the page sotre messages table")
@Option(name = "--jdbc-page-store-table-name", description = "Name of the page store messages table")
private String jdbcPageStore = ActiveMQDefaultConfiguration.getDefaultPageStoreTableName();
@Option(name = "--jdbc-node-manager-table-name", description = "Name of the jdbc node manager table")
private String jdbcNodeManager = ActiveMQDefaultConfiguration.getDefaultNodeManagerStoreTableName();
@Option(name = "--jdbc-connection-url", description = "The connection used for the database")
private String jdbcURL = null;
@ -620,6 +623,7 @@ public class Create extends InputAbstract {
filters.put("${jdbcMessages}", jdbcMessages);
filters.put("${jdbcLargeMessages}", jdbcLargeMessages);
filters.put("${jdbcPageStore}", jdbcPageStore);
filters.put("${jdbcNodeManager}", jdbcNodeManager);
filters.put("${jdbcURL}", jdbcURL);
filters.put("${jdbcClassName}", jdbcClassName);
filters.put("${jdbcNetworkTimeout}", "" + jdbcNetworkTimeout);

View File

@ -74,9 +74,12 @@ public class DBOption extends OptionalLocking {
@Option(name = "--jdbc-large-message-table-name", description = "Name of the large messages table")
private String jdbcLargeMessages = ActiveMQDefaultConfiguration.getDefaultLargeMessagesTableName();
@Option(name = "--jdbc-page-store-table-name", description = "Name of the page sotre messages table")
@Option(name = "--jdbc-page-store-table-name", description = "Name of the page store messages table")
private String jdbcPageStore = ActiveMQDefaultConfiguration.getDefaultPageStoreTableName();
@Option(name = "--jdbc-node-manager-table-name", description = "Name of the jdbc node manager table")
private String jdbcNodeManager = ActiveMQDefaultConfiguration.getDefaultNodeManagerStoreTableName();
@Option(name = "--jdbc-connection-url", description = "The connection used for the database")
private String jdbcURL = null;
@ -128,6 +131,16 @@ public class DBOption extends OptionalLocking {
return this;
}
public String getJdbcNodeManager() throws Exception {
parseDBConfig();
return jdbcNodeManager;
}
public DBOption setJdbcNodeManager(String jdbcNodeManager) {
this.jdbcNodeManager = jdbcNodeManager;
return this;
}
public String getJdbcURL() throws Exception {
parseDBConfig();
return jdbcURL;
@ -173,6 +186,7 @@ public class DBOption extends OptionalLocking {
jdbcMessages = storageConfiguration.getMessageTableName();
jdbcLargeMessages = storageConfiguration.getLargeMessageTableName();
jdbcPageStore = storageConfiguration.getPageStoreTableName();
jdbcNodeManager = storageConfiguration.getNodeManagerStoreTableName();
jdbcURL = storageConfiguration.getJdbcConnectionUrl();
jdbcClassName = storageConfiguration.getJdbcDriverClassName();
}
@ -190,6 +204,7 @@ public class DBOption extends OptionalLocking {
storageConfiguration.setMessageTableName(getJdbcMessages());
storageConfiguration.setLargeMessageTableName(getJdbcLargeMessages());
storageConfiguration.setPageStoreTableName(getJdbcPageStore());
storageConfiguration.setNodeManagerStoreTableName(getJdbcNodeManager());
configuration.setStoreConfiguration(storageConfiguration);
} else {
configuration.setBindingsDirectory(getBinding());

View File

@ -10,6 +10,7 @@
<bindings-table-name>${jdbcBindings}</bindings-table-name>
<large-message-table-name>${jdbcLargeMessages}</large-message-table-name>
<page-store-table-name>${jdbcPageStore}</page-store-table-name>
<node-manager-store-table-name>${jdbcNodeManager}</node-manager-store-table-name>
<jdbc-lock-expiration>${jdbcLockExpiration}</jdbc-lock-expiration>
<jdbc-lock-renew-period>${jdbcLockRenewPeriod}</jdbc-lock-renew-period>
<jdbc-max-allowed-millis-from-db-time>${jdbcMaxAllowedMillisFromDbTime}</jdbc-max-allowed-millis-from-db-time>

View File

@ -1467,6 +1467,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
conf.setMessageTableName(getString(storeNode, "message-table-name", conf.getMessageTableName(), Validators.NO_CHECK));
conf.setLargeMessageTableName(getString(storeNode, "large-message-table-name", conf.getJdbcConnectionUrl(), Validators.NO_CHECK));
conf.setPageStoreTableName(getString(storeNode, "page-store-table-name", conf.getPageStoreTableName(), Validators.NO_CHECK));
conf.setNodeManagerStoreTableName(getString(storeNode, "node-manager-store-table-name", conf.getNodeManagerStoreTableName(), Validators.NO_CHECK));
conf.setJdbcConnectionUrl(getString(storeNode, "jdbc-connection-url", conf.getJdbcConnectionUrl(), Validators.NO_CHECK));
conf.setJdbcDriverClassName(getString(storeNode, "jdbc-driver-class-name", conf.getJdbcDriverClassName(), Validators.NO_CHECK));
conf.setJdbcNetworkTimeout(getInteger(storeNode, "jdbc-network-timeout", conf.getJdbcNetworkTimeout(), Validators.NO_CHECK));

View File

@ -1935,6 +1935,13 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="node-manager-store-table-name" type="xsd:string" minOccurs="0" maxOccurs="1">
<xsd:annotation>
<xsd:documentation>
The table name used to hold shared store data
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="jdbc-network-timeout" type="xsd:int" minOccurs="0" maxOccurs="1">
<xsd:annotation>
<xsd:documentation>

View File

@ -417,6 +417,7 @@ To configure Apache ActiveMQ Artemis to use a database for persisting messages a
<message-table-name>MESSAGE_TABLE</message-table-name>
<page-store-table-name>MESSAGE_TABLE</page-store-table-name>
<large-message-table-name>LARGE_MESSAGES_TABLE</large-message-table-name>
<node-manager-store-table-name>NODE_MANAGER_TABLE</node-manager-store-table-name>
<jdbc-driver-class-name>org.apache.derby.jdbc.EmbeddedDriver</jdbc-driver-class-name>
</database-store>
</store>
@ -442,6 +443,11 @@ To configure Apache ActiveMQ Artemis to use a database for persisting messages a
The name of the table to house the page store directory information. Note that each address will have it's own page table which will use this name appended with a unique id of up to 20 characters.
- `node-manager-store-table-name`
The name of the table in which the HA Shared Store locks (ie live and backup) and HA related data will be persisted for the ActiveMQ Artemis server. Specifying table names allows users to share single database amongst multiple servers, without interference.
Each Shared Store live/backup pairs must use the same table name and isn't supported to share the same table between multiple (and unrelated) live/backup pairs.
- `jdbc-driver-class-name`
The fully qualified class name of the desired database Driver.