/** * Get the name of the EmbeddedActiveMQ server * * @return name of the embedded server */ public String getServerName() { String name = "unknown"; ActiveMQServer activeMQServer = server.getActiveMQServer(); if (activeMQServer != null) { name = activeMQServer.getConfiguration().getName(); } else if (configuration != null) { name = configuration.getName(); } return name; }
/** * Get the name of the EmbeddedJMS server * * @return name of the server */ public String getServerName() { String name = "unknown"; ActiveMQServer activeMQServer = jmsServer.getActiveMQServer(); if (activeMQServer != null) { name = activeMQServer.getConfiguration().getName(); } else if (configuration != null) { name = configuration.getName(); } return name; }
/** * Get the name of the EmbeddedActiveMQ server * * @return name of the embedded server */ public String getServerName() { String name = "unknown"; ActiveMQServer activeMQServer = server.getActiveMQServer(); if (activeMQServer != null) { name = activeMQServer.getConfiguration().getName(); } else if (configuration != null) { name = configuration.getName(); } return name; }
/** * Get the name of the EmbeddedJMS server * * @return name of the server */ public String getServerName() { String name = "unknown"; ActiveMQServer activeMQServer = jmsServer.getActiveMQServer(); if (activeMQServer != null) { name = activeMQServer.getConfiguration().getName(); } else if (configuration != null) { name = configuration.getName(); } return name; }
private static void updateAcceptorsAndConnectors(Configuration backupConfiguration, int portOffset, List<String> remoteConnectors, boolean fullServer) { //we only do this if we are a full server, if scale down then our acceptors wont be needed and our connectors will // be the same as the parent server if (fullServer) { Set<TransportConfiguration> acceptors = backupConfiguration.getAcceptorConfigurations(); for (TransportConfiguration acceptor : acceptors) { updatebackupParams(backupConfiguration.getName(), portOffset, acceptor.getParams()); } Map<String, TransportConfiguration> connectorConfigurations = backupConfiguration.getConnectorConfigurations(); for (Map.Entry<String, TransportConfiguration> entry : connectorConfigurations.entrySet()) { //check to make sure we aren't a remote connector as this shouldn't be changed if (!remoteConnectors.contains(entry.getValue().getName())) { updatebackupParams(backupConfiguration.getName(), portOffset, entry.getValue().getParams()); } } } else { //if we are scaling down then we wont need any acceptors but clear anyway for belts and braces backupConfiguration.getAcceptorConfigurations().clear(); } }
private static ActiveMQServer selectServer(HttpServerExchange exchange, ActiveMQServer rootServer) { String activemqServerName = exchange.getRequestHeaders().getFirst(TransportConstants.ACTIVEMQ_SERVER_NAME); if (activemqServerName == null) { return rootServer; } ClusterManager clusterManager = rootServer.getClusterManager(); if (clusterManager != null) { HAManager haManager = clusterManager.getHAManager(); if (haManager != null) { for (Map.Entry<String, ActiveMQServer> entry : haManager.getBackupServers().entrySet()) { if (entry.getKey().equals(activemqServerName)) { return entry.getValue(); } } } } if (activemqServerName.equals(rootServer.getConfiguration().getName())) { return rootServer; } else { return null; } }
private static ActiveMQServer selectServer(HttpServerExchange exchange, ActiveMQServer rootServer) { String activemqServerName = exchange.getRequestHeaders().getFirst(TransportConstants.ACTIVEMQ_SERVER_NAME); if (activemqServerName == null) { return rootServer; } ClusterManager clusterManager = rootServer.getClusterManager(); if (clusterManager != null) { HAManager haManager = clusterManager.getHAManager(); if (haManager != null) { for (Map.Entry<String, ActiveMQServer> entry : haManager.getBackupServers().entrySet()) { if (entry.getKey().equals(activemqServerName)) { return entry.getValue(); } } } } if (activemqServerName.equals(rootServer.getConfiguration().getName())) { return rootServer; } else { return null; } }
public ManagementServiceImpl(final MBeanServer mbeanServer, final Configuration configuration) { this.mbeanServer = mbeanServer; jmxManagementEnabled = configuration.isJMXManagementEnabled(); messageCounterEnabled = configuration.isMessageCounterEnabled(); managementAddress = configuration.getManagementAddress(); managementNotificationAddress = configuration.getManagementNotificationAddress(); registry = new ConcurrentHashMap<>(); broadcaster = new NotificationBroadcasterSupport(); notificationsEnabled = true; objectNameBuilder = ObjectNameBuilder.create(configuration.getJMXDomain(), configuration.getName(), configuration.isJMXUseBrokerName()); }
ModelNode serverNameModelNode = HTTPConnectorDefinition.SERVER_NAME.resolveModelAttribute(context, config); String serverName = serverNameModelNode.isDefined() ? serverNameModelNode.asString() : configuration.getName(); parameters.put(ACTIVEMQ_SERVER_NAME, serverName);
ModelNode serverNameModelNode = HTTPConnectorDefinition.SERVER_NAME.resolveModelAttribute(context, config); String serverName = serverNameModelNode.isDefined() ? serverNameModelNode.asString() : configuration.getName(); parameters.put(ACTIVEMQ_SERVER_NAME, serverName);
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; }
activationThread.start(); } else { ActiveMQServerLogger.LOGGER.serverStarted(getVersion().getFullVersion(), configuration.getName(), nodeManager.getNodeId(), identity != null ? identity : "");
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) {
@Override public ConnectionEntry createConnectionEntry(Acceptor acceptorUsed, Connection remotingConnection) { AMQPConnectionCallback connectionCallback = new AMQPConnectionCallback(this, remotingConnection, server.getExecutorFactory().getExecutor(), server); long ttl = ActiveMQClient.DEFAULT_CONNECTION_TTL; if (server.getConfiguration().getConnectionTTLOverride() != -1) { ttl = server.getConfiguration().getConnectionTTLOverride(); } if (getAmqpIdleTimeout() != null) { ttl = getAmqpIdleTimeout().longValue(); } if (ttl < 0) { ttl = 0; } String id = server.getConfiguration().getName(); boolean useCoreSubscriptionNaming = server.getConfiguration().isAmqpUseCoreSubscriptionNaming(); AMQPConnectionContext amqpConnection = new AMQPConnectionContext(this, connectionCallback, id, (int) ttl, getMaxFrameSize(), AMQPConstants.Connection.DEFAULT_CHANNEL_MAX, useCoreSubscriptionNaming, server.getScheduledPool(), true, null, null); Executor executor = server.getExecutorFactory().getExecutor(); ActiveMQProtonRemotingConnection delegate = new ActiveMQProtonRemotingConnection(this, amqpConnection, remotingConnection, executor); delegate.addFailureListener(connectionCallback); delegate.addCloseListener(connectionCallback); connectionCallback.setProtonConnectionDelegate(delegate); // connection entry only understands -1 otherwise we would see disconnects for no reason ConnectionEntry entry = new ConnectionEntry(delegate, executor, System.currentTimeMillis(), ttl <= 0 ? -1 : ttl); return entry; }
@Override public ConnectionEntry createConnectionEntry(Acceptor acceptorUsed, Connection remotingConnection) { AMQPConnectionCallback connectionCallback = new AMQPConnectionCallback(this, remotingConnection, server.getExecutorFactory().getExecutor(), server); long ttl = ActiveMQClient.DEFAULT_CONNECTION_TTL; if (server.getConfiguration().getConnectionTTLOverride() != -1) { ttl = server.getConfiguration().getConnectionTTLOverride(); } if (getAmqpIdleTimeout() != null) { ttl = getAmqpIdleTimeout().longValue(); } if (ttl < 0) { ttl = 0; } String id = server.getConfiguration().getName(); boolean useCoreSubscriptionNaming = server.getConfiguration().isAmqpUseCoreSubscriptionNaming(); AMQPConnectionContext amqpConnection = new AMQPConnectionContext(this, connectionCallback, id, (int) ttl, getMaxFrameSize(), AMQPConstants.Connection.DEFAULT_CHANNEL_MAX, useCoreSubscriptionNaming, server.getScheduledPool(), true, null, null); Executor executor = server.getExecutorFactory().getExecutor(); ActiveMQProtonRemotingConnection delegate = new ActiveMQProtonRemotingConnection(this, amqpConnection, remotingConnection, executor); delegate.addFailureListener(connectionCallback); delegate.addCloseListener(connectionCallback); connectionCallback.setProtonConnectionDelegate(delegate); // connection entry only understands -1 otherwise we would see disconnects for no reason ConnectionEntry entry = new ConnectionEntry(delegate, executor, System.currentTimeMillis(), ttl <= 0 ? -1 : ttl); return entry; }
public void parseMainConfig(final Element e, final Configuration config) throws Exception { config.setName(getString(e, "name", config.getName(), Validators.NO_CHECK));
public void testDefaults() { Assert.assertEquals("SomeNameForUseOnTheApplicationServer", conf.getName()); Assert.assertEquals(false, conf.isPersistenceEnabled()); Assert.assertEquals(true, conf.isClustered());