Search in sources :

Example 1 with ColocatedPolicyConfiguration

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;
}
Also used : HAPolicyConfiguration(org.apache.activemq.artemis.core.config.HAPolicyConfiguration) ColocatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration) ModelNode(org.jboss.dmr.ModelNode)

Example 2 with ColocatedPolicyConfiguration

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;
}
Also used : HAPolicyConfiguration(org.apache.activemq.artemis.core.config.HAPolicyConfiguration) ColocatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration) ModelNode(org.jboss.dmr.ModelNode)

Example 3 with ColocatedPolicyConfiguration

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;
}
Also used : HAPolicyConfiguration(org.apache.activemq.artemis.core.config.HAPolicyConfiguration) ColocatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration) ModelNode(org.jboss.dmr.ModelNode)

Example 4 with ColocatedPolicyConfiguration

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;
}
Also used : HAPolicyConfiguration(org.apache.activemq.artemis.core.config.HAPolicyConfiguration) ColocatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration) ModelNode(org.jboss.dmr.ModelNode)

Example 5 with ColocatedPolicyConfiguration

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;
}
Also used : ColocatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) Element(org.w3c.dom.Element) SimpleString(org.apache.activemq.artemis.api.core.SimpleString)

Aggregations

ColocatedPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration)8 HAPolicyConfiguration (org.apache.activemq.artemis.core.config.HAPolicyConfiguration)5 ModelNode (org.jboss.dmr.ModelNode)4 SharedStoreMasterPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration)3 SharedStoreSlavePolicyConfiguration (org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration)3 TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)2 ScaleDownConfiguration (org.apache.activemq.artemis.core.config.ScaleDownConfiguration)2 ArrayList (java.util.ArrayList)1 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)1 Configuration (org.apache.activemq.artemis.core.config.Configuration)1 CoreQueueConfiguration (org.apache.activemq.artemis.core.config.CoreQueueConfiguration)1 ReplicaPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration)1 ReplicatedPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration)1 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)1 InVMNodeManager (org.apache.activemq.artemis.core.server.impl.InVMNodeManager)1 Element (org.w3c.dom.Element)1 Node (org.w3c.dom.Node)1 NodeList (org.w3c.dom.NodeList)1