Search in sources :

Example 1 with LiveOnlyPolicyConfiguration

use of org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration in project activemq-artemis by apache.

the class FileConfigurationParser method parseMainConfig.

public void parseMainConfig(final Element e, final Configuration config) throws Exception {
    config.setName(getString(e, "name", config.getName(), Validators.NO_CHECK));
    config.setSystemPropertyPrefix(getString(e, "system-property-prefix", config.getSystemPropertyPrefix(), Validators.NOT_NULL_OR_EMPTY));
    NodeList haPolicyNodes = e.getElementsByTagName("ha-policy");
    if (haPolicyNodes.getLength() > 0) {
        parseHAPolicyConfiguration((Element) haPolicyNodes.item(0), config);
    }
    // if we aren already set then set to default
    if (config.getHAPolicyConfiguration() == null) {
        config.setHAPolicyConfiguration(new LiveOnlyPolicyConfiguration());
    }
    NodeList storeTypeNodes = e.getElementsByTagName("store");
    if (storeTypeNodes.getLength() > 0) {
        parseStoreConfiguration((Element) storeTypeNodes.item(0), config);
    }
    config.setResolveProtocols(getBoolean(e, "resolve-protocols", config.isResolveProtocols()));
    config.setPersistenceEnabled(getBoolean(e, "persistence-enabled", config.isPersistenceEnabled()));
    config.setPersistDeliveryCountBeforeDelivery(getBoolean(e, "persist-delivery-count-before-delivery", config.isPersistDeliveryCountBeforeDelivery()));
    config.setScheduledThreadPoolMaxSize(getInteger(e, "scheduled-thread-pool-max-size", config.getScheduledThreadPoolMaxSize(), Validators.GT_ZERO));
    config.setThreadPoolMaxSize(getInteger(e, "thread-pool-max-size", config.getThreadPoolMaxSize(), Validators.MINUS_ONE_OR_GT_ZERO));
    config.setSecurityEnabled(getBoolean(e, "security-enabled", config.isSecurityEnabled()));
    config.setGracefulShutdownEnabled(getBoolean(e, "graceful-shutdown-enabled", config.isGracefulShutdownEnabled()));
    config.setGracefulShutdownTimeout(getLong(e, "graceful-shutdown-timeout", config.getGracefulShutdownTimeout(), Validators.MINUS_ONE_OR_GE_ZERO));
    config.setJMXManagementEnabled(getBoolean(e, "jmx-management-enabled", config.isJMXManagementEnabled()));
    config.setJMXDomain(getString(e, "jmx-domain", config.getJMXDomain(), Validators.NOT_NULL_OR_EMPTY));
    config.setJMXUseBrokerName(getBoolean(e, "jmx-use-broker-name", config.isJMXUseBrokerName()));
    config.setSecurityInvalidationInterval(getLong(e, "security-invalidation-interval", config.getSecurityInvalidationInterval(), Validators.GT_ZERO));
    config.setConnectionTTLOverride(getLong(e, "connection-ttl-override", config.getConnectionTTLOverride(), Validators.MINUS_ONE_OR_GT_ZERO));
    config.setEnabledAsyncConnectionExecution(getBoolean(e, "async-connection-execution-enabled", config.isAsyncConnectionExecutionEnabled()));
    config.setTransactionTimeout(getLong(e, "transaction-timeout", config.getTransactionTimeout(), Validators.GT_ZERO));
    config.setTransactionTimeoutScanPeriod(getLong(e, "transaction-timeout-scan-period", config.getTransactionTimeoutScanPeriod(), Validators.GT_ZERO));
    config.setMessageExpiryScanPeriod(getLong(e, "message-expiry-scan-period", config.getMessageExpiryScanPeriod(), Validators.MINUS_ONE_OR_GT_ZERO));
    config.setMessageExpiryThreadPriority(getInteger(e, "message-expiry-thread-priority", config.getMessageExpiryThreadPriority(), Validators.THREAD_PRIORITY_RANGE));
    config.setIDCacheSize(getInteger(e, "id-cache-size", config.getIDCacheSize(), Validators.GT_ZERO));
    config.setPersistIDCache(getBoolean(e, "persist-id-cache", config.isPersistIDCache()));
    config.setManagementAddress(new SimpleString(getString(e, "management-address", config.getManagementAddress().toString(), Validators.NOT_NULL_OR_EMPTY)));
    config.setManagementNotificationAddress(new SimpleString(getString(e, "management-notification-address", config.getManagementNotificationAddress().toString(), Validators.NOT_NULL_OR_EMPTY)));
    config.setMaskPassword(getBoolean(e, "mask-password", null));
    config.setPasswordCodec(getString(e, "password-codec", DefaultSensitiveStringCodec.class.getName(), Validators.NOT_NULL_OR_EMPTY));
    config.setPopulateValidatedUser(getBoolean(e, "populate-validated-user", config.isPopulateValidatedUser()));
    config.setConnectionTtlCheckInterval(getLong(e, "connection-ttl-check-interval", config.getConnectionTtlCheckInterval(), Validators.GT_ZERO));
    config.setConfigurationFileRefreshPeriod(getLong(e, "configuration-file-refresh-period", config.getConfigurationFileRefreshPeriod(), Validators.GT_ZERO));
    long globalMaxSize = getTextBytesAsLongBytes(e, GLOBAL_MAX_SIZE, -1, Validators.MINUS_ONE_OR_GT_ZERO);
    if (globalMaxSize > 0) {
        // We only set it if it's not set on the XML, otherwise getGlobalMaxSize will calculate it.
        // We do it this way because it will be valid also on the case of embedded
        config.setGlobalMaxSize(globalMaxSize);
    }
    config.setMaxDiskUsage(getInteger(e, MAX_DISK_USAGE, config.getMaxDiskUsage(), Validators.PERCENTAGE_OR_MINUS_ONE));
    config.setDiskScanPeriod(getInteger(e, DISK_SCAN_PERIOD, config.getDiskScanPeriod(), Validators.MINUS_ONE_OR_GT_ZERO));
    config.setInternalNamingPrefix(getString(e, INTERNAL_NAMING_PREFIX, config.getInternalNamingPrefix(), Validators.NO_CHECK));
    config.setAmqpUseCoreSubscriptionNaming(getBoolean(e, AMQP_USE_CORE_SUBSCRIPTION_NAMING, config.isAmqpUseCoreSubscriptionNaming()));
    // parsing cluster password
    String passwordText = getString(e, "cluster-password", null, Validators.NO_CHECK);
    final Boolean maskText = config.isMaskPassword();
    if (passwordText != null) {
        String resolvedPassword = PasswordMaskingUtil.resolveMask(maskText, passwordText, config.getPasswordCodec());
        config.setClusterPassword(resolvedPassword);
    }
    config.setClusterUser(getString(e, "cluster-user", config.getClusterUser(), Validators.NO_CHECK));
    NodeList interceptorNodes = e.getElementsByTagName("remoting-interceptors");
    ArrayList<String> incomingInterceptorList = new ArrayList<>();
    if (interceptorNodes.getLength() > 0) {
        NodeList interceptors = interceptorNodes.item(0).getChildNodes();
        for (int i = 0; i < interceptors.getLength(); i++) {
            if ("class-name".equalsIgnoreCase(interceptors.item(i).getNodeName())) {
                String clazz = getTrimmedTextContent(interceptors.item(i));
                incomingInterceptorList.add(clazz);
            }
        }
    }
    NodeList incomingInterceptorNodes = e.getElementsByTagName("remoting-incoming-interceptors");
    if (incomingInterceptorNodes.getLength() > 0) {
        NodeList interceptors = incomingInterceptorNodes.item(0).getChildNodes();
        for (int i = 0; i < interceptors.getLength(); i++) {
            if ("class-name".equalsIgnoreCase(interceptors.item(i).getNodeName())) {
                String clazz = getTrimmedTextContent(interceptors.item(i));
                incomingInterceptorList.add(clazz);
            }
        }
    }
    config.setIncomingInterceptorClassNames(incomingInterceptorList);
    NodeList outgoingInterceptorNodes = e.getElementsByTagName("remoting-outgoing-interceptors");
    ArrayList<String> outgoingInterceptorList = new ArrayList<>();
    if (outgoingInterceptorNodes.getLength() > 0) {
        NodeList interceptors = outgoingInterceptorNodes.item(0).getChildNodes();
        for (int i = 0; i < interceptors.getLength(); i++) {
            if ("class-name".equalsIgnoreCase(interceptors.item(i).getNodeName())) {
                String clazz = interceptors.item(i).getTextContent();
                outgoingInterceptorList.add(clazz);
            }
        }
    }
    config.setOutgoingInterceptorClassNames(outgoingInterceptorList);
    NodeList connectorNodes = e.getElementsByTagName("connector");
    for (int i = 0; i < connectorNodes.getLength(); i++) {
        Element connectorNode = (Element) connectorNodes.item(i);
        TransportConfiguration connectorConfig = parseConnectorTransportConfiguration(connectorNode, config);
        if (connectorConfig.getName() == null) {
            ActiveMQServerLogger.LOGGER.connectorWithNoName();
            continue;
        }
        if (config.getConnectorConfigurations().containsKey(connectorConfig.getName())) {
            ActiveMQServerLogger.LOGGER.connectorAlreadyDeployed(connectorConfig.getName());
            continue;
        }
        config.getConnectorConfigurations().put(connectorConfig.getName(), connectorConfig);
    }
    NodeList acceptorNodes = e.getElementsByTagName("acceptor");
    for (int i = 0; i < acceptorNodes.getLength(); i++) {
        Element acceptorNode = (Element) acceptorNodes.item(i);
        TransportConfiguration acceptorConfig = parseAcceptorTransportConfiguration(acceptorNode, config);
        config.getAcceptorConfigurations().add(acceptorConfig);
    }
    NodeList bgNodes = e.getElementsByTagName("broadcast-group");
    for (int i = 0; i < bgNodes.getLength(); i++) {
        Element bgNode = (Element) bgNodes.item(i);
        parseBroadcastGroupConfiguration(bgNode, config);
    }
    NodeList dgNodes = e.getElementsByTagName("discovery-group");
    for (int i = 0; i < dgNodes.getLength(); i++) {
        Element dgNode = (Element) dgNodes.item(i);
        parseDiscoveryGroupConfiguration(dgNode, config);
    }
    NodeList brNodes = e.getElementsByTagName("bridge");
    for (int i = 0; i < brNodes.getLength(); i++) {
        Element mfNode = (Element) brNodes.item(i);
        parseBridgeConfiguration(mfNode, config);
    }
    NodeList gaNodes = e.getElementsByTagName("grouping-handler");
    for (int i = 0; i < gaNodes.getLength(); i++) {
        Element gaNode = (Element) gaNodes.item(i);
        parseGroupingHandlerConfiguration(gaNode, config);
    }
    NodeList ccNodes = e.getElementsByTagName("cluster-connection");
    for (int i = 0; i < ccNodes.getLength(); i++) {
        Element ccNode = (Element) ccNodes.item(i);
        parseClusterConnectionConfiguration(ccNode, config);
    }
    NodeList ccNodesURI = e.getElementsByTagName("cluster-connection-uri");
    for (int i = 0; i < ccNodesURI.getLength(); i++) {
        Element ccNode = (Element) ccNodesURI.item(i);
        parseClusterConnectionConfigurationURI(ccNode, config);
    }
    NodeList dvNodes = e.getElementsByTagName("divert");
    for (int i = 0; i < dvNodes.getLength(); i++) {
        Element dvNode = (Element) dvNodes.item(i);
        parseDivertConfiguration(dvNode, config);
    }
    // Persistence config
    config.setLargeMessagesDirectory(getString(e, "large-messages-directory", config.getLargeMessagesDirectory(), Validators.NOT_NULL_OR_EMPTY));
    config.setBindingsDirectory(getString(e, "bindings-directory", config.getBindingsDirectory(), Validators.NOT_NULL_OR_EMPTY));
    config.setCreateBindingsDir(getBoolean(e, "create-bindings-dir", config.isCreateBindingsDir()));
    config.setJournalDirectory(getString(e, "journal-directory", config.getJournalDirectory(), Validators.NOT_NULL_OR_EMPTY));
    config.setPageMaxConcurrentIO(getInteger(e, "page-max-concurrent-io", config.getPageMaxConcurrentIO(), Validators.MINUS_ONE_OR_GT_ZERO));
    config.setPagingDirectory(getString(e, "paging-directory", config.getPagingDirectory(), Validators.NOT_NULL_OR_EMPTY));
    config.setCreateJournalDir(getBoolean(e, "create-journal-dir", config.isCreateJournalDir()));
    String s = getString(e, "journal-type", config.getJournalType().toString(), Validators.JOURNAL_TYPE);
    config.setJournalType(JournalType.getType(s));
    if (config.getJournalType() == JournalType.ASYNCIO) {
        // https://jira.jboss.org/jira/browse/HORNETQ-295
        // We do the check here to see if AIO is supported so we can use the correct defaults and/or use
        // correct settings in xml
        // If we fall back later on these settings can be ignored
        boolean supportsAIO = AIOSequentialFileFactory.isSupported();
        if (!supportsAIO) {
            if (validateAIO) {
                ActiveMQServerLogger.LOGGER.AIONotFound();
            }
            config.setJournalType(JournalType.NIO);
        }
    }
    config.setJournalDatasync(getBoolean(e, "journal-datasync", config.isJournalDatasync()));
    config.setJournalSyncTransactional(getBoolean(e, "journal-sync-transactional", config.isJournalSyncTransactional()));
    config.setJournalSyncNonTransactional(getBoolean(e, "journal-sync-non-transactional", config.isJournalSyncNonTransactional()));
    config.setJournalFileSize(getTextBytesAsIntBytes(e, "journal-file-size", config.getJournalFileSize(), Validators.GT_ZERO));
    int journalBufferTimeout = getInteger(e, "journal-buffer-timeout", config.getJournalType() == JournalType.ASYNCIO ? ArtemisConstants.DEFAULT_JOURNAL_BUFFER_TIMEOUT_AIO : ArtemisConstants.DEFAULT_JOURNAL_BUFFER_TIMEOUT_NIO, Validators.GE_ZERO);
    int journalBufferSize = getTextBytesAsIntBytes(e, "journal-buffer-size", config.getJournalType() == JournalType.ASYNCIO ? ArtemisConstants.DEFAULT_JOURNAL_BUFFER_SIZE_AIO : ArtemisConstants.DEFAULT_JOURNAL_BUFFER_SIZE_NIO, Validators.GT_ZERO);
    int journalMaxIO = getInteger(e, "journal-max-io", config.getJournalType() == JournalType.ASYNCIO ? ActiveMQDefaultConfiguration.getDefaultJournalMaxIoAio() : ActiveMQDefaultConfiguration.getDefaultJournalMaxIoNio(), Validators.GT_ZERO);
    if (config.getJournalType() == JournalType.ASYNCIO) {
        config.setJournalBufferTimeout_AIO(journalBufferTimeout);
        config.setJournalBufferSize_AIO(journalBufferSize);
        config.setJournalMaxIO_AIO(journalMaxIO);
    } else {
        config.setJournalBufferTimeout_NIO(journalBufferTimeout);
        config.setJournalBufferSize_NIO(journalBufferSize);
        config.setJournalMaxIO_NIO(journalMaxIO);
    }
    config.setJournalFileOpenTimeout(getInteger(e, "journal-file-open-timeout", ActiveMQDefaultConfiguration.getDefaultJournalFileOpenTimeout(), Validators.GT_ZERO));
    config.setJournalMinFiles(getInteger(e, "journal-min-files", config.getJournalMinFiles(), Validators.GT_ZERO));
    config.setJournalPoolFiles(getInteger(e, "journal-pool-files", config.getJournalPoolFiles(), Validators.MINUS_ONE_OR_GT_ZERO));
    config.setJournalCompactMinFiles(getInteger(e, "journal-compact-min-files", config.getJournalCompactMinFiles(), Validators.GE_ZERO));
    config.setJournalCompactPercentage(getInteger(e, "journal-compact-percentage", config.getJournalCompactPercentage(), Validators.PERCENTAGE));
    config.setLogJournalWriteRate(getBoolean(e, "log-journal-write-rate", ActiveMQDefaultConfiguration.isDefaultJournalLogWriteRate()));
    if (e.hasAttribute("wild-card-routing-enabled")) {
        config.setWildcardRoutingEnabled(getBoolean(e, "wild-card-routing-enabled", config.isWildcardRoutingEnabled()));
    }
    config.setMessageCounterEnabled(getBoolean(e, "message-counter-enabled", config.isMessageCounterEnabled()));
    config.setMessageCounterSamplePeriod(getLong(e, "message-counter-sample-period", config.getMessageCounterSamplePeriod(), Validators.GT_ZERO));
    config.setMessageCounterMaxDayHistory(getInteger(e, "message-counter-max-day-history", config.getMessageCounterMaxDayHistory(), Validators.GT_ZERO));
    // in milliseconds
    config.setServerDumpInterval(getLong(e, "server-dump-interval", config.getServerDumpInterval(), Validators.MINUS_ONE_OR_GT_ZERO));
    config.setMemoryWarningThreshold(getInteger(e, "memory-warning-threshold", config.getMemoryWarningThreshold(), Validators.PERCENTAGE));
    config.setMemoryMeasureInterval(getLong(e, "memory-measure-interval", config.getMemoryMeasureInterval(), Validators.MINUS_ONE_OR_GT_ZERO));
    config.setNetworkCheckList(getString(e, "network-check-list", config.getNetworkCheckList(), Validators.NO_CHECK));
    config.setNetworkCheckURLList(getString(e, "network-check-URL-list", config.getNetworkCheckURLList(), Validators.NO_CHECK));
    config.setNetworkCheckPeriod(getLong(e, "network-check-period", config.getNetworkCheckPeriod(), Validators.GT_ZERO));
    config.setNetworkCheckTimeout(getInteger(e, "network-check-timeout", config.getNetworkCheckTimeout(), Validators.GT_ZERO));
    config.setNetworCheckNIC(getString(e, "network-check-NIC", config.getNetworkCheckNIC(), Validators.NO_CHECK));
    config.setNetworkCheckPing6Command(getString(e, "network-check-ping6-command", config.getNetworkCheckPing6Command(), Validators.NO_CHECK));
    config.setNetworkCheckPingCommand(getString(e, "network-check-ping-command", config.getNetworkCheckPingCommand(), Validators.NO_CHECK));
    config.setCriticalAnalyzer(getBoolean(e, "critical-analyzer", config.isCriticalAnalyzer()));
    config.setCriticalAnalyzerTimeout(getLong(e, "critical-analyzer-timeout", config.getCriticalAnalyzerTimeout(), Validators.GE_ZERO));
    config.setCriticalAnalyzerCheckPeriod(getLong(e, "critical-analyzer-check-period", config.getCriticalAnalyzerCheckPeriod(), Validators.GE_ZERO));
    config.setCriticalAnalyzerPolicy(CriticalAnalyzerPolicy.valueOf(getString(e, "critical-analyzer-policy", config.getCriticalAnalyzerPolicy().name(), Validators.NOT_NULL_OR_EMPTY)));
    parseAddressSettings(e, config);
    parseResourceLimits(e, config);
    parseQueues(e, config);
    parseAddresses(e, config);
    parseSecurity(e, config);
    parseBrokerPlugins(e, config);
    NodeList connectorServiceConfigs = e.getElementsByTagName("connector-service");
    ArrayList<ConnectorServiceConfiguration> configs = new ArrayList<>();
    for (int i = 0; i < connectorServiceConfigs.getLength(); i++) {
        Element node = (Element) connectorServiceConfigs.item(i);
        configs.add((parseConnectorService(node)));
    }
    config.setConnectorServiceConfigurations(configs);
    NodeList wildCardConfiguration = e.getElementsByTagName("wildcard-addresses");
    if (wildCardConfiguration.getLength() > 0) {
        parseWildcardConfiguration((Element) wildCardConfiguration.item(0), config);
    }
}
Also used : NodeList(org.w3c.dom.NodeList) Element(org.w3c.dom.Element) ArrayList(java.util.ArrayList) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) LiveOnlyPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration) ConnectorServiceConfiguration(org.apache.activemq.artemis.core.config.ConnectorServiceConfiguration)

Example 2 with LiveOnlyPolicyConfiguration

use of org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration in project activemq-artemis by apache.

the class FileConfigurationParser method createLiveOnlyHaPolicy.

private LiveOnlyPolicyConfiguration createLiveOnlyHaPolicy(Element policyNode) {
    LiveOnlyPolicyConfiguration configuration = new LiveOnlyPolicyConfiguration();
    configuration.setScaleDownConfiguration(parseScaleDownConfig(policyNode));
    return configuration;
}
Also used : LiveOnlyPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration)

Example 3 with LiveOnlyPolicyConfiguration

use of org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration in project activemq-artemis by apache.

the class FileConfigurationTest method testDefaults.

@Override
@Test
public void testDefaults() {
    // Check they match the values from the test file
    Assert.assertEquals("SomeNameForUseOnTheApplicationServer", conf.getName());
    Assert.assertEquals(false, conf.isPersistenceEnabled());
    Assert.assertEquals(true, conf.isClustered());
    Assert.assertEquals(12345, conf.getScheduledThreadPoolMaxSize());
    Assert.assertEquals(54321, conf.getThreadPoolMaxSize());
    Assert.assertEquals(false, conf.isSecurityEnabled());
    Assert.assertEquals(5423, conf.getSecurityInvalidationInterval());
    Assert.assertEquals(true, conf.isWildcardRoutingEnabled());
    Assert.assertEquals(new SimpleString("Giraffe"), conf.getManagementAddress());
    Assert.assertEquals(new SimpleString("Whatever"), conf.getManagementNotificationAddress());
    Assert.assertEquals("Frog", conf.getClusterUser());
    Assert.assertEquals("Wombat", conf.getClusterPassword());
    Assert.assertEquals(false, conf.isJMXManagementEnabled());
    Assert.assertEquals("gro.qtenroh", conf.getJMXDomain());
    Assert.assertEquals(true, conf.isMessageCounterEnabled());
    Assert.assertEquals(5, conf.getMessageCounterMaxDayHistory());
    Assert.assertEquals(123456, conf.getMessageCounterSamplePeriod());
    Assert.assertEquals(12345, conf.getConnectionTTLOverride());
    Assert.assertEquals(98765, conf.getTransactionTimeout());
    Assert.assertEquals(56789, conf.getTransactionTimeoutScanPeriod());
    Assert.assertEquals(10111213, conf.getMessageExpiryScanPeriod());
    Assert.assertEquals(8, conf.getMessageExpiryThreadPriority());
    Assert.assertEquals(127, conf.getIDCacheSize());
    Assert.assertEquals(true, conf.isPersistIDCache());
    Assert.assertEquals(true, conf.isPersistDeliveryCountBeforeDelivery());
    Assert.assertEquals("pagingdir", conf.getPagingDirectory());
    Assert.assertEquals("somedir", conf.getBindingsDirectory());
    Assert.assertEquals(false, conf.isCreateBindingsDir());
    Assert.assertEquals(true, conf.isAmqpUseCoreSubscriptionNaming());
    Assert.assertEquals("max concurrent io", 17, conf.getPageMaxConcurrentIO());
    Assert.assertEquals("somedir2", conf.getJournalDirectory());
    Assert.assertEquals(false, conf.isCreateJournalDir());
    Assert.assertEquals(JournalType.NIO, conf.getJournalType());
    Assert.assertEquals(10000, conf.getJournalBufferSize_NIO());
    Assert.assertEquals(1000, conf.getJournalBufferTimeout_NIO());
    Assert.assertEquals(56546, conf.getJournalMaxIO_NIO());
    Assert.assertEquals(9876, conf.getJournalFileOpenTimeout());
    Assert.assertEquals(false, conf.isJournalSyncTransactional());
    Assert.assertEquals(true, conf.isJournalSyncNonTransactional());
    Assert.assertEquals(12345678, conf.getJournalFileSize());
    Assert.assertEquals(100, conf.getJournalMinFiles());
    Assert.assertEquals(123, conf.getJournalCompactMinFiles());
    Assert.assertEquals(33, conf.getJournalCompactPercentage());
    Assert.assertEquals(true, conf.isGracefulShutdownEnabled());
    Assert.assertEquals(12345, conf.getGracefulShutdownTimeout());
    Assert.assertEquals(true, conf.isPopulateValidatedUser());
    Assert.assertEquals(98765, conf.getConnectionTtlCheckInterval());
    Assert.assertEquals(1234567, conf.getConfigurationFileRefreshPeriod());
    Assert.assertEquals("127.0.0.1", conf.getNetworkCheckList());
    Assert.assertEquals("some-nick", conf.getNetworkCheckNIC());
    Assert.assertEquals(123, conf.getNetworkCheckPeriod());
    Assert.assertEquals(321, conf.getNetworkCheckTimeout());
    Assert.assertEquals("ping-four", conf.getNetworkCheckPingCommand());
    Assert.assertEquals("ping-six", conf.getNetworkCheckPing6Command());
    Assert.assertEquals("largemessagesdir", conf.getLargeMessagesDirectory());
    Assert.assertEquals(95, conf.getMemoryWarningThreshold());
    Assert.assertEquals(2, conf.getIncomingInterceptorClassNames().size());
    Assert.assertTrue(conf.getIncomingInterceptorClassNames().contains("org.apache.activemq.artemis.tests.unit.core.config.impl.TestInterceptor1"));
    Assert.assertTrue(conf.getIncomingInterceptorClassNames().contains("org.apache.activemq.artemis.tests.unit.core.config.impl.TestInterceptor2"));
    Assert.assertEquals(2, conf.getConnectorConfigurations().size());
    TransportConfiguration tc = conf.getConnectorConfigurations().get("connector1");
    Assert.assertNotNull(tc);
    Assert.assertEquals("org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory", tc.getFactoryClassName());
    Assert.assertEquals("mylocal", tc.getParams().get("localAddress"));
    Assert.assertEquals("99", tc.getParams().get("localPort"));
    Assert.assertEquals("localhost1", tc.getParams().get("host"));
    Assert.assertEquals("5678", tc.getParams().get("port"));
    tc = conf.getConnectorConfigurations().get("connector2");
    Assert.assertNotNull(tc);
    Assert.assertEquals("org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory", tc.getFactoryClassName());
    Assert.assertEquals("5", tc.getParams().get("serverId"));
    Assert.assertEquals(2, conf.getAcceptorConfigurations().size());
    for (TransportConfiguration ac : conf.getAcceptorConfigurations()) {
        if (ac.getFactoryClassName().equals("org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory")) {
            Assert.assertEquals("456", ac.getParams().get("tcpNoDelay"));
            Assert.assertEquals("44", ac.getParams().get("connectionTtl"));
            Assert.assertEquals("92", ac.getParams().get(TransportConstants.CONNECTIONS_ALLOWED));
        } else {
            Assert.assertEquals("org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory", ac.getFactoryClassName());
            Assert.assertEquals("0", ac.getParams().get("serverId"));
            Assert.assertEquals("87", ac.getParams().get(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.CONNECTIONS_ALLOWED));
        }
    }
    Assert.assertEquals(2, conf.getBroadcastGroupConfigurations().size());
    for (BroadcastGroupConfiguration bc : conf.getBroadcastGroupConfigurations()) {
        UDPBroadcastEndpointFactory udpBc = (UDPBroadcastEndpointFactory) bc.getEndpointFactory();
        if (bc.getName().equals("bg1")) {
            Assert.assertEquals("bg1", bc.getName());
            Assert.assertEquals(10999, udpBc.getLocalBindPort());
            Assert.assertEquals("192.168.0.120", udpBc.getGroupAddress());
            Assert.assertEquals(11999, udpBc.getGroupPort());
            Assert.assertEquals(12345, bc.getBroadcastPeriod());
            Assert.assertEquals("connector1", bc.getConnectorInfos().get(0));
        } else {
            Assert.assertEquals("bg2", bc.getName());
            Assert.assertEquals(12999, udpBc.getLocalBindPort());
            Assert.assertEquals("192.168.0.121", udpBc.getGroupAddress());
            Assert.assertEquals(13999, udpBc.getGroupPort());
            Assert.assertEquals(23456, bc.getBroadcastPeriod());
            Assert.assertEquals("connector2", bc.getConnectorInfos().get(0));
        }
    }
    Assert.assertEquals(2, conf.getDiscoveryGroupConfigurations().size());
    DiscoveryGroupConfiguration dc = conf.getDiscoveryGroupConfigurations().get("dg1");
    Assert.assertEquals("dg1", dc.getName());
    Assert.assertEquals("192.168.0.120", ((UDPBroadcastEndpointFactory) dc.getBroadcastEndpointFactory()).getGroupAddress());
    assertEquals("172.16.8.10", ((UDPBroadcastEndpointFactory) dc.getBroadcastEndpointFactory()).getLocalBindAddress());
    Assert.assertEquals(11999, ((UDPBroadcastEndpointFactory) dc.getBroadcastEndpointFactory()).getGroupPort());
    Assert.assertEquals(12345, dc.getRefreshTimeout());
    dc = conf.getDiscoveryGroupConfigurations().get("dg2");
    Assert.assertEquals("dg2", dc.getName());
    Assert.assertEquals("192.168.0.121", ((UDPBroadcastEndpointFactory) dc.getBroadcastEndpointFactory()).getGroupAddress());
    assertEquals("172.16.8.11", ((UDPBroadcastEndpointFactory) dc.getBroadcastEndpointFactory()).getLocalBindAddress());
    Assert.assertEquals(12999, ((UDPBroadcastEndpointFactory) dc.getBroadcastEndpointFactory()).getGroupPort());
    Assert.assertEquals(23456, dc.getRefreshTimeout());
    Assert.assertEquals(3, conf.getDivertConfigurations().size());
    for (DivertConfiguration dic : conf.getDivertConfigurations()) {
        if (dic.getName().equals("divert1")) {
            Assert.assertEquals("divert1", dic.getName());
            Assert.assertEquals("routing-name1", dic.getRoutingName());
            Assert.assertEquals("address1", dic.getAddress());
            Assert.assertEquals("forwarding-address1", dic.getForwardingAddress());
            Assert.assertEquals("speed > 88", dic.getFilterString());
            Assert.assertEquals("org.foo.Transformer", dic.getTransformerConfiguration().getClassName());
            Assert.assertEquals(true, dic.isExclusive());
        } else if (dic.getName().equals("divert2")) {
            Assert.assertEquals("divert2", dic.getName());
            Assert.assertEquals("routing-name2", dic.getRoutingName());
            Assert.assertEquals("address2", dic.getAddress());
            Assert.assertEquals("forwarding-address2", dic.getForwardingAddress());
            Assert.assertEquals("speed < 88", dic.getFilterString());
            Assert.assertEquals("org.foo.Transformer2", dic.getTransformerConfiguration().getClassName());
            Assert.assertEquals(false, dic.isExclusive());
        } else {
            Assert.assertEquals("divert3", dic.getName());
            Assert.assertEquals("org.foo.DivertTransformer3", dic.getTransformerConfiguration().getClassName());
            Assert.assertEquals("divertTransformerValue1", dic.getTransformerConfiguration().getProperties().get("divertTransformerKey1"));
            Assert.assertEquals("divertTransformerValue2", dic.getTransformerConfiguration().getProperties().get("divertTransformerKey2"));
        }
    }
    Assert.assertEquals(3, conf.getBridgeConfigurations().size());
    for (BridgeConfiguration bc : conf.getBridgeConfigurations()) {
        if (bc.getName().equals("bridge1")) {
            Assert.assertEquals("bridge1", bc.getName());
            Assert.assertEquals("queue1", bc.getQueueName());
            Assert.assertEquals("minLargeMessageSize", 4194304, bc.getMinLargeMessageSize());
            assertEquals("check-period", 31, bc.getClientFailureCheckPeriod());
            assertEquals("connection time-to-live", 370, bc.getConnectionTTL());
            Assert.assertEquals("bridge-forwarding-address1", bc.getForwardingAddress());
            Assert.assertEquals("sku > 1", bc.getFilterString());
            Assert.assertEquals("org.foo.BridgeTransformer", bc.getTransformerConfiguration().getClassName());
            Assert.assertEquals(3, bc.getRetryInterval());
            Assert.assertEquals(0.2, bc.getRetryIntervalMultiplier(), 0.0001);
            assertEquals("max retry interval", 10002, bc.getMaxRetryInterval());
            Assert.assertEquals(2, bc.getReconnectAttempts());
            Assert.assertEquals(true, bc.isUseDuplicateDetection());
            Assert.assertEquals("connector1", bc.getStaticConnectors().get(0));
            Assert.assertEquals(null, bc.getDiscoveryGroupName());
            Assert.assertEquals(444, bc.getProducerWindowSize());
            Assert.assertEquals(1073741824, bc.getConfirmationWindowSize());
        } else if (bc.getName().equals("bridge2")) {
            Assert.assertEquals("bridge2", bc.getName());
            Assert.assertEquals("queue2", bc.getQueueName());
            Assert.assertEquals("bridge-forwarding-address2", bc.getForwardingAddress());
            Assert.assertEquals(null, bc.getFilterString());
            Assert.assertEquals(null, bc.getTransformerConfiguration());
            Assert.assertEquals(null, bc.getStaticConnectors());
            Assert.assertEquals("dg1", bc.getDiscoveryGroupName());
            Assert.assertEquals(568320, bc.getProducerWindowSize());
        } else {
            Assert.assertEquals("bridge3", bc.getName());
            Assert.assertEquals("org.foo.BridgeTransformer3", bc.getTransformerConfiguration().getClassName());
            Assert.assertEquals("bridgeTransformerValue1", bc.getTransformerConfiguration().getProperties().get("bridgeTransformerKey1"));
            Assert.assertEquals("bridgeTransformerValue2", bc.getTransformerConfiguration().getProperties().get("bridgeTransformerKey2"));
        }
    }
    Assert.assertEquals(2, conf.getClusterConfigurations().size());
    HAPolicyConfiguration pc = conf.getHAPolicyConfiguration();
    assertNotNull(pc);
    assertTrue(pc instanceof LiveOnlyPolicyConfiguration);
    LiveOnlyPolicyConfiguration lopc = (LiveOnlyPolicyConfiguration) pc;
    assertNotNull(lopc.getScaleDownConfiguration());
    assertEquals(lopc.getScaleDownConfiguration().getGroupName(), "boo!");
    assertEquals(lopc.getScaleDownConfiguration().getDiscoveryGroup(), "dg1");
    for (ClusterConnectionConfiguration ccc : conf.getClusterConfigurations()) {
        if (ccc.getName().equals("cluster-connection1")) {
            Assert.assertEquals("cluster-connection1", ccc.getName());
            Assert.assertEquals("clusterConnectionConf minLargeMessageSize", 321, ccc.getMinLargeMessageSize());
            assertEquals("check-period", 331, ccc.getClientFailureCheckPeriod());
            assertEquals("connection time-to-live", 3370, ccc.getConnectionTTL());
            Assert.assertEquals("queues1", ccc.getAddress());
            Assert.assertEquals(3, ccc.getRetryInterval());
            Assert.assertEquals(true, ccc.isDuplicateDetection());
            Assert.assertEquals(MessageLoadBalancingType.ON_DEMAND, ccc.getMessageLoadBalancingType());
            Assert.assertEquals(1, ccc.getMaxHops());
            Assert.assertEquals(123, ccc.getCallTimeout());
            Assert.assertEquals(123, ccc.getCallFailoverTimeout());
            assertEquals("multiplier", 0.25, ccc.getRetryIntervalMultiplier(), 0.00001);
            assertEquals("max retry interval", 10000, ccc.getMaxRetryInterval());
            assertEquals(72, ccc.getReconnectAttempts());
            Assert.assertEquals("connector1", ccc.getStaticConnectors().get(0));
            Assert.assertEquals("connector2", ccc.getStaticConnectors().get(1));
            Assert.assertEquals(null, ccc.getDiscoveryGroupName());
            Assert.assertEquals(222, ccc.getProducerWindowSize());
        } else {
            Assert.assertEquals("cluster-connection2", ccc.getName());
            Assert.assertEquals("queues2", ccc.getAddress());
            Assert.assertEquals(4, ccc.getRetryInterval());
            Assert.assertEquals(456, ccc.getCallTimeout());
            Assert.assertEquals(456, ccc.getCallFailoverTimeout());
            Assert.assertEquals(false, ccc.isDuplicateDetection());
            Assert.assertEquals(MessageLoadBalancingType.STRICT, ccc.getMessageLoadBalancingType());
            Assert.assertEquals(2, ccc.getMaxHops());
            Assert.assertEquals(Collections.emptyList(), ccc.getStaticConnectors());
            Assert.assertEquals("dg1", ccc.getDiscoveryGroupName());
            Assert.assertEquals(333, ccc.getProducerWindowSize());
        }
    }
    assertEquals(2, conf.getAddressesSettings().size());
    assertTrue(conf.getAddressesSettings().get("a1") != null);
    assertTrue(conf.getAddressesSettings().get("a2") != null);
    assertEquals("a1.1", conf.getAddressesSettings().get("a1").getDeadLetterAddress().toString());
    assertEquals("a1.2", conf.getAddressesSettings().get("a1").getExpiryAddress().toString());
    assertEquals(1, conf.getAddressesSettings().get("a1").getRedeliveryDelay());
    assertEquals(856686592L, conf.getAddressesSettings().get("a1").getMaxSizeBytes());
    assertEquals(81738173872337L, conf.getAddressesSettings().get("a1").getPageSizeBytes());
    assertEquals(10, conf.getAddressesSettings().get("a1").getPageCacheMaxSize());
    assertEquals(4, conf.getAddressesSettings().get("a1").getMessageCounterHistoryDayLimit());
    assertEquals(10, conf.getAddressesSettings().get("a1").getSlowConsumerThreshold());
    assertEquals(5, conf.getAddressesSettings().get("a1").getSlowConsumerCheckPeriod());
    assertEquals(SlowConsumerPolicy.NOTIFY, conf.getAddressesSettings().get("a1").getSlowConsumerPolicy());
    assertEquals(true, conf.getAddressesSettings().get("a1").isAutoCreateJmsQueues());
    assertEquals(true, conf.getAddressesSettings().get("a1").isAutoDeleteJmsQueues());
    assertEquals(true, conf.getAddressesSettings().get("a1").isAutoCreateJmsTopics());
    assertEquals(true, conf.getAddressesSettings().get("a1").isAutoDeleteJmsTopics());
    assertEquals(false, conf.getAddressesSettings().get("a1").isDefaultPurgeOnNoConsumers());
    assertEquals(5, conf.getAddressesSettings().get("a1").getDefaultMaxConsumers());
    assertEquals(RoutingType.ANYCAST, conf.getAddressesSettings().get("a1").getDefaultQueueRoutingType());
    assertEquals(RoutingType.MULTICAST, conf.getAddressesSettings().get("a1").getDefaultAddressRoutingType());
    assertEquals("a2.1", conf.getAddressesSettings().get("a2").getDeadLetterAddress().toString());
    assertEquals("a2.2", conf.getAddressesSettings().get("a2").getExpiryAddress().toString());
    assertEquals(5, conf.getAddressesSettings().get("a2").getRedeliveryDelay());
    assertEquals(932489234928324L, conf.getAddressesSettings().get("a2").getMaxSizeBytes());
    assertEquals(7126716262626L, conf.getAddressesSettings().get("a2").getPageSizeBytes());
    assertEquals(20, conf.getAddressesSettings().get("a2").getPageCacheMaxSize());
    assertEquals(8, conf.getAddressesSettings().get("a2").getMessageCounterHistoryDayLimit());
    assertEquals(20, conf.getAddressesSettings().get("a2").getSlowConsumerThreshold());
    assertEquals(15, conf.getAddressesSettings().get("a2").getSlowConsumerCheckPeriod());
    assertEquals(SlowConsumerPolicy.KILL, conf.getAddressesSettings().get("a2").getSlowConsumerPolicy());
    assertEquals(false, conf.getAddressesSettings().get("a2").isAutoCreateJmsQueues());
    assertEquals(false, conf.getAddressesSettings().get("a2").isAutoDeleteJmsQueues());
    assertEquals(false, conf.getAddressesSettings().get("a2").isAutoCreateJmsTopics());
    assertEquals(false, conf.getAddressesSettings().get("a2").isAutoDeleteJmsTopics());
    assertEquals(true, conf.getAddressesSettings().get("a2").isDefaultPurgeOnNoConsumers());
    assertEquals(15, conf.getAddressesSettings().get("a2").getDefaultMaxConsumers());
    assertEquals(RoutingType.MULTICAST, conf.getAddressesSettings().get("a2").getDefaultQueueRoutingType());
    assertEquals(RoutingType.ANYCAST, conf.getAddressesSettings().get("a2").getDefaultAddressRoutingType());
    assertTrue(conf.getResourceLimitSettings().containsKey("myUser"));
    assertEquals(104, conf.getResourceLimitSettings().get("myUser").getMaxConnections());
    assertEquals(13, conf.getResourceLimitSettings().get("myUser").getMaxQueues());
    assertEquals(2, conf.getQueueConfigurations().size());
    assertEquals("queue1", conf.getQueueConfigurations().get(0).getName());
    assertEquals("address1", conf.getQueueConfigurations().get(0).getAddress());
    assertEquals("color='red'", conf.getQueueConfigurations().get(0).getFilterString());
    assertEquals(false, conf.getQueueConfigurations().get(0).isDurable());
    assertEquals("queue2", conf.getQueueConfigurations().get(1).getName());
    assertEquals("address2", conf.getQueueConfigurations().get(1).getAddress());
    assertEquals("color='blue'", conf.getQueueConfigurations().get(1).getFilterString());
    assertEquals(false, conf.getQueueConfigurations().get(1).isDurable());
    verifyAddresses();
    Map<String, Set<Role>> roles = conf.getSecurityRoles();
    assertEquals(2, roles.size());
    assertTrue(roles.containsKey("a1"));
    assertTrue(roles.containsKey("a2"));
    Role a1Role = roles.get("a1").toArray(new Role[1])[0];
    assertFalse(a1Role.isSend());
    assertFalse(a1Role.isConsume());
    assertFalse(a1Role.isCreateDurableQueue());
    assertFalse(a1Role.isDeleteDurableQueue());
    assertTrue(a1Role.isCreateNonDurableQueue());
    assertFalse(a1Role.isDeleteNonDurableQueue());
    assertFalse(a1Role.isManage());
    Role a2Role = roles.get("a2").toArray(new Role[1])[0];
    assertFalse(a2Role.isSend());
    assertFalse(a2Role.isConsume());
    assertFalse(a2Role.isCreateDurableQueue());
    assertFalse(a2Role.isDeleteDurableQueue());
    assertFalse(a2Role.isCreateNonDurableQueue());
    assertTrue(a2Role.isDeleteNonDurableQueue());
    assertFalse(a2Role.isManage());
    assertEquals(1234567, conf.getGlobalMaxSize());
    assertEquals(37, conf.getMaxDiskUsage());
    assertEquals(123, conf.getDiskScanPeriod());
    assertEquals(333, conf.getCriticalAnalyzerCheckPeriod());
    assertEquals(777, conf.getCriticalAnalyzerTimeout());
    assertEquals(false, conf.isCriticalAnalyzer());
    assertEquals(CriticalAnalyzerPolicy.HALT, conf.getCriticalAnalyzerPolicy());
    assertEquals(false, conf.isJournalDatasync());
}
Also used : ClusterConnectionConfiguration(org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration) HashSet(java.util.HashSet) Set(java.util.Set) BridgeConfiguration(org.apache.activemq.artemis.core.config.BridgeConfiguration) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) DiscoveryGroupConfiguration(org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) Role(org.apache.activemq.artemis.core.security.Role) HAPolicyConfiguration(org.apache.activemq.artemis.core.config.HAPolicyConfiguration) LiveOnlyPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration) DivertConfiguration(org.apache.activemq.artemis.core.config.DivertConfiguration) BroadcastGroupConfiguration(org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration) UDPBroadcastEndpointFactory(org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory) Test(org.junit.Test)

Example 4 with LiveOnlyPolicyConfiguration

use of org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration in project activemq-artemis by apache.

the class ScaleDownFailoverTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    stopCount = 0;
    setupLiveServer(0, isFileStorage(), false, isNetty(), true);
    setupLiveServer(1, isFileStorage(), false, isNetty(), true);
    setupLiveServer(2, isFileStorage(), false, isNetty(), true);
    ScaleDownConfiguration scaleDownConfiguration = new ScaleDownConfiguration();
    ScaleDownConfiguration scaleDownConfiguration2 = new ScaleDownConfiguration();
    scaleDownConfiguration2.setEnabled(false);
    ScaleDownConfiguration scaleDownConfiguration3 = new ScaleDownConfiguration();
    scaleDownConfiguration3.setEnabled(false);
    ((LiveOnlyPolicyConfiguration) servers[0].getConfiguration().getHAPolicyConfiguration()).setScaleDownConfiguration(scaleDownConfiguration);
    ((LiveOnlyPolicyConfiguration) servers[1].getConfiguration().getHAPolicyConfiguration()).setScaleDownConfiguration(scaleDownConfiguration2);
    ((LiveOnlyPolicyConfiguration) servers[2].getConfiguration().getHAPolicyConfiguration()).setScaleDownConfiguration(scaleDownConfiguration3);
    if (isGrouped()) {
        scaleDownConfiguration.setGroupName("bill");
        scaleDownConfiguration2.setGroupName("bill");
        scaleDownConfiguration3.setGroupName("bill");
    }
    staticServers = servers;
    setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2);
    setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0, 2);
    setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1);
    scaleDownConfiguration.getConnectors().addAll(servers[0].getConfiguration().getClusterConfigurations().iterator().next().getStaticConnectors());
    scaleDownConfiguration2.getConnectors().addAll(servers[1].getConfiguration().getClusterConfigurations().iterator().next().getStaticConnectors());
    scaleDownConfiguration3.getConnectors().addAll(servers[2].getConfiguration().getClusterConfigurations().iterator().next().getStaticConnectors());
    startServers(0, 1, 2);
    setupSessionFactory(0, isNetty());
    setupSessionFactory(1, isNetty());
    setupSessionFactory(2, isNetty());
}
Also used : LiveOnlyPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration) ScaleDownConfiguration(org.apache.activemq.artemis.core.config.ScaleDownConfiguration) Before(org.junit.Before)

Example 5 with LiveOnlyPolicyConfiguration

use of org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration in project activemq-artemis by apache.

the class ScaleDownFailureTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    setupLiveServer(0, isFileStorage(), false, isNetty(), true);
    setupLiveServer(1, isFileStorage(), false, isNetty(), true);
    if (isGrouped()) {
        ScaleDownConfiguration scaleDownConfiguration = new ScaleDownConfiguration();
        scaleDownConfiguration.setGroupName("bill");
        ((LiveOnlyPolicyConfiguration) servers[0].getConfiguration().getHAPolicyConfiguration()).setScaleDownConfiguration(scaleDownConfiguration);
        ((LiveOnlyPolicyConfiguration) servers[1].getConfiguration().getHAPolicyConfiguration()).setScaleDownConfiguration(scaleDownConfiguration);
    }
    setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1);
    setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0);
    startServers(0, 1);
    setupSessionFactory(0, isNetty());
    setupSessionFactory(1, isNetty());
}
Also used : LiveOnlyPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration) ScaleDownConfiguration(org.apache.activemq.artemis.core.config.ScaleDownConfiguration) Before(org.junit.Before)

Aggregations

LiveOnlyPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration)9 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)4 ScaleDownConfiguration (org.apache.activemq.artemis.core.config.ScaleDownConfiguration)4 Before (org.junit.Before)4 TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)3 ActiveMQDefaultConfiguration (org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration)2 BroadcastGroupConfiguration (org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration)2 DiscoveryGroupConfiguration (org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration)2 ClusterConnectionConfiguration (org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration)2 Configuration (org.apache.activemq.artemis.core.config.Configuration)2 HAPolicyConfiguration (org.apache.activemq.artemis.core.config.HAPolicyConfiguration)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 UDPBroadcastEndpointFactory (org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory)1 BridgeConfiguration (org.apache.activemq.artemis.core.config.BridgeConfiguration)1 ConnectorServiceConfiguration (org.apache.activemq.artemis.core.config.ConnectorServiceConfiguration)1 DivertConfiguration (org.apache.activemq.artemis.core.config.DivertConfiguration)1 ReplicaPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration)1