Search in sources :

Example 26 with SharedStoreMasterPolicyConfiguration

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

the class ActiveMQConnectionFactoryTest method startServer.

private void startServer() throws Exception {
    liveTC = new TransportConfiguration(INVM_CONNECTOR_FACTORY);
    Map<String, TransportConfiguration> connectors = new HashMap<>();
    connectors.put(liveTC.getName(), liveTC);
    List<String> connectorNames = new ArrayList<>();
    connectorNames.add(liveTC.getName());
    Configuration liveConf = createBasicConfig().addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY)).setConnectorConfigurations(connectors).setHAPolicyConfiguration(new SharedStoreMasterPolicyConfiguration());
    final long broadcastPeriod = 250;
    final String bcGroupName = "bc1";
    final int localBindPort = 5432;
    BroadcastGroupConfiguration bcConfig1 = new BroadcastGroupConfiguration().setName(bcGroupName).setBroadcastPeriod(broadcastPeriod).setConnectorInfos(connectorNames).setEndpointFactory(new UDPBroadcastEndpointFactory().setGroupAddress(groupAddress).setGroupPort(groupPort).setLocalBindPort(localBindPort));
    List<BroadcastGroupConfiguration> bcConfigs1 = new ArrayList<>();
    bcConfigs1.add(bcConfig1);
    liveConf.setBroadcastGroupConfigurations(bcConfigs1);
    liveService = addServer(ActiveMQServers.newActiveMQServer(liveConf, false));
    liveService.start();
}
Also used : Configuration(org.apache.activemq.artemis.core.config.Configuration) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) DiscoveryGroupConfiguration(org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration) BroadcastGroupConfiguration(org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) BroadcastGroupConfiguration(org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration) UDPBroadcastEndpointFactory(org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory)

Example 27 with SharedStoreMasterPolicyConfiguration

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

the class SimpleJNDIClientTest method startServer.

private void startServer() throws Exception {
    liveTC = new TransportConfiguration(INVM_CONNECTOR_FACTORY);
    Map<String, TransportConfiguration> connectors = new HashMap<>();
    connectors.put(liveTC.getName(), liveTC);
    List<String> connectorNames = new ArrayList<>();
    connectorNames.add(liveTC.getName());
    Map<String, Object> params = new HashMap<>();
    params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, 1);
    Configuration liveConf = createBasicConfig().addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY)).addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY, params)).addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY)).setConnectorConfigurations(connectors).setHAPolicyConfiguration(new SharedStoreMasterPolicyConfiguration()).setSecurityEnabled(true);
    final long broadcastPeriod = 250;
    final String bcGroupName = "bc1";
    final int localBindPort = 5432;
    BroadcastGroupConfiguration bcConfig1 = new BroadcastGroupConfiguration().setName(bcGroupName).setBroadcastPeriod(broadcastPeriod).setConnectorInfos(connectorNames).setEndpointFactory(new UDPBroadcastEndpointFactory().setGroupAddress(groupAddress).setGroupPort(groupPort).setLocalBindPort(localBindPort));
    List<BroadcastGroupConfiguration> bcConfigs1 = new ArrayList<>();
    bcConfigs1.add(bcConfig1);
    liveConf.setBroadcastGroupConfigurations(bcConfigs1);
    liveService = addServer(ActiveMQServers.newActiveMQServer(liveConf, false));
    ((ActiveMQJAASSecurityManager) liveService.getSecurityManager()).getConfiguration().addUser("guest", "guest");
    ((ActiveMQJAASSecurityManager) liveService.getSecurityManager()).getConfiguration().setDefaultUser("guest");
    liveService.start();
}
Also used : Configuration(org.apache.activemq.artemis.core.config.Configuration) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) ActiveMQDefaultConfiguration(org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration) DiscoveryGroupConfiguration(org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration) BroadcastGroupConfiguration(org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) JGroupsFileBroadcastEndpoint(org.apache.activemq.artemis.api.core.JGroupsFileBroadcastEndpoint) BroadcastEndpoint(org.apache.activemq.artemis.api.core.BroadcastEndpoint) BroadcastGroupConfiguration(org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration) UDPBroadcastEndpointFactory(org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory)

Aggregations

SharedStoreMasterPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration)27 TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)21 SharedStoreSlavePolicyConfiguration (org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration)20 Configuration (org.apache.activemq.artemis.core.config.Configuration)16 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)9 InVMNodeManager (org.apache.activemq.artemis.core.server.impl.InVMNodeManager)9 ReplicatedPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration)8 ReplicaPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration)7 ArrayList (java.util.ArrayList)6 HAPolicyConfiguration (org.apache.activemq.artemis.core.config.HAPolicyConfiguration)6 BroadcastGroupConfiguration (org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration)5 DiscoveryGroupConfiguration (org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration)5 ActiveMQDefaultConfiguration (org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration)4 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)4 UDPBroadcastEndpointFactory (org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory)4 ClusterConnectionConfiguration (org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration)4 ScaleDownConfiguration (org.apache.activemq.artemis.core.config.ScaleDownConfiguration)3 ColocatedPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration)3 JndiBindingRegistry (org.apache.activemq.artemis.core.registry.JndiBindingRegistry)3 NodeManager (org.apache.activemq.artemis.core.server.NodeManager)3