use of org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration in project wildfly by wildfly.
the class HAPolicyConfigurationBuilder method buildReplicationColocatedConfiguration.
private HAPolicyConfiguration buildReplicationColocatedConfiguration(OperationContext context, ModelNode model) throws OperationFailedException {
ColocatedPolicyConfiguration haPolicyConfiguration = new ColocatedPolicyConfiguration().setRequestBackup(REQUEST_BACKUP.resolveModelAttribute(context, model).asBoolean()).setBackupRequestRetries(BACKUP_REQUEST_RETRIES.resolveModelAttribute(context, model).asInt()).setBackupRequestRetryInterval(BACKUP_REQUEST_RETRY_INTERVAL.resolveModelAttribute(context, model).asLong()).setMaxBackups(MAX_BACKUPS.resolveModelAttribute(context, model).asInt()).setBackupPortOffset(BACKUP_PORT_OFFSET.resolveModelAttribute(context, model).asInt());
List<String> connectors = EXCLUDED_CONNECTORS.unwrap(context, model);
if (!connectors.isEmpty()) {
haPolicyConfiguration.setExcludedConnectors(connectors);
}
ModelNode masterConfigurationModel = model.get(CONFIGURATION, MASTER);
HAPolicyConfiguration masterConfiguration = buildReplicationMasterConfiguration(context, masterConfigurationModel);
haPolicyConfiguration.setLiveConfig(masterConfiguration);
ModelNode slaveConfigurationModel = model.get(CONFIGURATION, SLAVE);
HAPolicyConfiguration slaveConfiguration = buildReplicationSlaveConfiguration(context, slaveConfigurationModel);
haPolicyConfiguration.setBackupConfig(slaveConfiguration);
return haPolicyConfiguration;
}
use of org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration in project wildfly by wildfly.
the class HAPolicyConfigurationBuilder method buildSharedStoreColocatedConfiguration.
private HAPolicyConfiguration buildSharedStoreColocatedConfiguration(OperationContext context, ModelNode model) throws OperationFailedException {
ColocatedPolicyConfiguration haPolicyConfiguration = new ColocatedPolicyConfiguration().setRequestBackup(REQUEST_BACKUP.resolveModelAttribute(context, model).asBoolean()).setBackupRequestRetries(BACKUP_REQUEST_RETRIES.resolveModelAttribute(context, model).asInt()).setBackupRequestRetryInterval(BACKUP_REQUEST_RETRY_INTERVAL.resolveModelAttribute(context, model).asLong()).setMaxBackups(MAX_BACKUPS.resolveModelAttribute(context, model).asInt()).setBackupPortOffset(BACKUP_PORT_OFFSET.resolveModelAttribute(context, model).asInt());
ModelNode masterConfigurationModel = model.get(CONFIGURATION, MASTER);
HAPolicyConfiguration masterConfiguration = buildSharedStoreMasterConfiguration(context, masterConfigurationModel);
haPolicyConfiguration.setLiveConfig(masterConfiguration);
ModelNode slaveConfigurationModel = model.get(CONFIGURATION, SLAVE);
HAPolicyConfiguration slaveConfiguration = buildSharedStoreSlaveConfiguration(context, slaveConfigurationModel);
haPolicyConfiguration.setBackupConfig(slaveConfiguration);
return haPolicyConfiguration;
}
use of org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration in project wildfly by wildfly.
the class ReplicationColocatedDefinition method buildConfiguration.
static HAPolicyConfiguration buildConfiguration(OperationContext context, ModelNode model) throws OperationFailedException {
ColocatedPolicyConfiguration haPolicyConfiguration = new ColocatedPolicyConfiguration().setRequestBackup(REQUEST_BACKUP.resolveModelAttribute(context, model).asBoolean()).setBackupRequestRetries(BACKUP_REQUEST_RETRIES.resolveModelAttribute(context, model).asInt()).setBackupRequestRetryInterval(BACKUP_REQUEST_RETRY_INTERVAL.resolveModelAttribute(context, model).asLong()).setMaxBackups(MAX_BACKUPS.resolveModelAttribute(context, model).asInt()).setBackupPortOffset(BACKUP_PORT_OFFSET.resolveModelAttribute(context, model).asInt());
List<String> connectors = EXCLUDED_CONNECTORS.unwrap(context, model);
if (!connectors.isEmpty()) {
haPolicyConfiguration.setExcludedConnectors(connectors);
}
ModelNode masterConfigurationModel = model.get(CONFIGURATION, MASTER);
HAPolicyConfiguration masterConfiguration = ReplicationMasterDefinition.buildConfiguration(context, masterConfigurationModel);
haPolicyConfiguration.setLiveConfig(masterConfiguration);
ModelNode slaveConfigurationModel = model.get(CONFIGURATION, SLAVE);
HAPolicyConfiguration slaveConfiguration = ReplicationSlaveDefinition.buildConfiguration(context, slaveConfigurationModel);
haPolicyConfiguration.setBackupConfig(slaveConfiguration);
return haPolicyConfiguration;
}
use of org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration in project wildfly by wildfly.
the class SharedStoreColocatedDefinition method buildConfiguration.
static HAPolicyConfiguration buildConfiguration(OperationContext context, ModelNode model) throws OperationFailedException {
ColocatedPolicyConfiguration haPolicyConfiguration = new ColocatedPolicyConfiguration().setRequestBackup(REQUEST_BACKUP.resolveModelAttribute(context, model).asBoolean()).setBackupRequestRetries(BACKUP_REQUEST_RETRIES.resolveModelAttribute(context, model).asInt()).setBackupRequestRetryInterval(BACKUP_REQUEST_RETRY_INTERVAL.resolveModelAttribute(context, model).asLong()).setMaxBackups(MAX_BACKUPS.resolveModelAttribute(context, model).asInt()).setBackupPortOffset(BACKUP_PORT_OFFSET.resolveModelAttribute(context, model).asInt());
ModelNode masterConfigurationModel = model.get(CONFIGURATION, MASTER);
HAPolicyConfiguration masterConfiguration = SharedStoreMasterDefinition.buildConfiguration(context, masterConfigurationModel);
haPolicyConfiguration.setLiveConfig(masterConfiguration);
ModelNode slaveConfigurationModel = model.get(CONFIGURATION, SLAVE);
HAPolicyConfiguration slaveConfiguration = SharedStoreSlaveDefinition.buildConfiguration(context, slaveConfigurationModel);
haPolicyConfiguration.setBackupConfig(slaveConfiguration);
return haPolicyConfiguration;
}
use of org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration in project activemq-artemis by apache.
the class FileConfigurationParser method createColocatedHaPolicy.
private ColocatedPolicyConfiguration createColocatedHaPolicy(Element policyNode, boolean replicated) {
ColocatedPolicyConfiguration configuration = new ColocatedPolicyConfiguration();
boolean requestBackup = getBoolean(policyNode, "request-backup", configuration.isRequestBackup());
configuration.setRequestBackup(requestBackup);
int backupRequestRetries = getInteger(policyNode, "backup-request-retries", configuration.getBackupRequestRetries(), Validators.MINUS_ONE_OR_GE_ZERO);
configuration.setBackupRequestRetries(backupRequestRetries);
long backupRequestRetryInterval = getLong(policyNode, "backup-request-retry-interval", configuration.getBackupRequestRetryInterval(), Validators.GT_ZERO);
configuration.setBackupRequestRetryInterval(backupRequestRetryInterval);
int maxBackups = getInteger(policyNode, "max-backups", configuration.getMaxBackups(), Validators.GE_ZERO);
configuration.setMaxBackups(maxBackups);
int backupPortOffset = getInteger(policyNode, "backup-port-offset", configuration.getBackupPortOffset(), Validators.GT_ZERO);
configuration.setBackupPortOffset(backupPortOffset);
NodeList remoteConnectorNode = policyNode.getElementsByTagName("excludes");
if (remoteConnectorNode != null && remoteConnectorNode.getLength() > 0) {
NodeList remoteConnectors = remoteConnectorNode.item(0).getChildNodes();
for (int i = 0; i < remoteConnectors.getLength(); i++) {
Node child = remoteConnectors.item(i);
if (child.getNodeName().equals("connector-ref")) {
String connectorName = getTrimmedTextContent(child);
configuration.getExcludedConnectors().add(connectorName);
}
}
}
NodeList masterNodeList = policyNode.getElementsByTagName("master");
if (masterNodeList.getLength() > 0) {
Element masterNode = (Element) masterNodeList.item(0);
configuration.setLiveConfig(replicated ? createReplicatedHaPolicy(masterNode) : createSharedStoreMasterHaPolicy(masterNode));
}
NodeList slaveNodeList = policyNode.getElementsByTagName("slave");
if (slaveNodeList.getLength() > 0) {
Element slaveNode = (Element) slaveNodeList.item(0);
configuration.setBackupConfig(replicated ? createReplicaHaPolicy(slaveNode) : createSharedStoreSlaveHaPolicy(slaveNode));
}
return configuration;
}
Aggregations