use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.
the class CoreProtocolManager method createConnectionEntry.
@Override
public ConnectionEntry createConnectionEntry(final Acceptor acceptorUsed, final Connection connection) {
final Configuration config = server.getConfiguration();
Executor connectionExecutor = server.getExecutorFactory().getExecutor();
final CoreRemotingConnection rc = new RemotingConnectionImpl(new ServerPacketDecoder(), connection, incomingInterceptors, outgoingInterceptors, config.isAsyncConnectionExecutionEnabled() ? connectionExecutor : null, server.getNodeID());
Channel channel1 = rc.getChannel(CHANNEL_ID.SESSION.id, -1);
ChannelHandler handler = new ActiveMQPacketHandler(this, server, channel1, rc);
channel1.setHandler(handler);
long ttl = ActiveMQClient.DEFAULT_CONNECTION_TTL;
if (config.getConnectionTTLOverride() != -1) {
ttl = config.getConnectionTTLOverride();
}
final ConnectionEntry entry = new ConnectionEntry(rc, connectionExecutor, System.currentTimeMillis(), ttl);
final Channel channel0 = rc.getChannel(ChannelImpl.CHANNEL_ID.PING.id, -1);
channel0.setHandler(new LocalChannelHandler(config, entry, channel0, acceptorUsed, rc));
server.getClusterManager().addClusterChannelHandler(rc.getChannel(CHANNEL_ID.CLUSTER.id, -1), acceptorUsed, rc, server.getActivation());
return entry;
}
use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.
the class ReplicationEndpoint method start.
@Override
public synchronized void start() throws Exception {
Configuration config = server.getConfiguration();
try {
storageManager = server.getStorageManager();
storageManager.start();
server.getManagementService().setStorageManager(storageManager);
journalsHolder.put(JournalContent.BINDINGS, storageManager.getBindingsJournal());
journalsHolder.put(JournalContent.MESSAGES, storageManager.getMessageJournal());
for (JournalContent jc : EnumSet.allOf(JournalContent.class)) {
filesReservedForSync.put(jc, new HashMap<Long, JournalSyncFile>());
// We only need to load internal structures on the backup...
journalLoadInformation[jc.typeByte] = journalsHolder.get(jc).loadSyncOnly(JournalState.SYNCING);
}
pageManager = new PagingManagerImpl(new PagingStoreFactoryNIO(storageManager, config.getPagingLocation(), config.getJournalBufferTimeout_NIO(), server.getScheduledPool(), server.getIOExecutorFactory(), config.isJournalSyncNonTransactional(), criticalErrorListener), server.getAddressSettingsRepository());
pageManager.start();
started = true;
} catch (Exception e) {
if (server.isStarted())
throw e;
}
}
use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.
the class ColocatedHAManager method activateSharedStoreBackup.
private synchronized boolean activateSharedStoreBackup(String journalDirectory, String bindingsDirectory, String largeMessagesDirectory, String pagingDirectory) throws Exception {
Configuration configuration = server.getConfiguration().copy();
ActiveMQServer backup = server.createBackupServer(configuration);
try {
int portOffset = haPolicy.getBackupPortOffset() * (backupServers.size() + 1);
String name = "colocated_backup_" + backupServers.size() + 1;
// make sure we don't restart as we are colocated
haPolicy.getBackupPolicy().setRestartBackup(false);
// set the backup policy
backup.setHAPolicy(haPolicy.getBackupPolicy());
updateSharedStoreConfiguration(configuration, name, portOffset, haPolicy.getExcludedConnectors(), journalDirectory, bindingsDirectory, largeMessagesDirectory, pagingDirectory, haPolicy.getBackupPolicy().getScaleDownPolicy() == null);
backupServers.put(configuration.getName(), backup);
backup.start();
} catch (Exception e) {
backup.stop();
ActiveMQServerLogger.LOGGER.activateSharedStoreSlaveFailed(e);
return false;
}
ActiveMQServerLogger.LOGGER.activatingSharedStoreSlave();
return true;
}
use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.
the class ColocatedHAManager method activateReplicatedBackup.
/**
* activate a backup server replicating from a specified node.
*
* decline and the requesting server can cast a re vote
*
* @param nodeID the id of the node to replicate from
* @return true if the server was created and started
* @throws Exception
*/
private synchronized boolean activateReplicatedBackup(SimpleString nodeID) throws Exception {
Configuration configuration = server.getConfiguration().copy();
ActiveMQServer backup = server.createBackupServer(configuration);
try {
TopologyMember member = server.getClusterManager().getDefaultConnection(null).getTopology().getMember(nodeID.toString());
int portOffset = haPolicy.getBackupPortOffset() * (backupServers.size() + 1);
String name = "colocated_backup_" + backupServers.size() + 1;
// make sure we don't restart as we are colocated
haPolicy.getBackupPolicy().setRestartBackup(false);
// set the backup policy
backup.setHAPolicy(haPolicy.getBackupPolicy());
updateReplicatedConfiguration(configuration, name, portOffset, haPolicy.getExcludedConnectors(), haPolicy.getBackupPolicy().getScaleDownPolicy() == null);
backup.addActivationParam(ActivationParams.REPLICATION_ENDPOINT, member);
backupServers.put(configuration.getName(), backup);
backup.start();
} catch (Exception e) {
backup.stop();
ActiveMQServerLogger.LOGGER.activateReplicatedBackupFailed(e);
return false;
}
ActiveMQServerLogger.LOGGER.activatingReplica(nodeID);
return true;
}
use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.
the class PersistentPushTopicConsumerTest method setup.
@BeforeClass
public static void setup() throws Exception {
Configuration configuration = new ConfigurationImpl().setPersistenceEnabled(false).setSecurityEnabled(false).addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
server = ActiveMQServers.newActiveMQServer(configuration);
server.start();
}
Aggregations