/** * @return the brokerName */ public String getBrokerName(){ return brokerService.getBrokerName(); }
@Override public String toString() { return "BrokerService[" + getBrokerName() + "]"; }
public URI getVmConnectorURI() { if (vmConnectorURI == null) { try { vmConnectorURI = new URI("vm://" + getBrokerName()); } catch (URISyntaxException e) { LOG.error("Badly formed URI from {}", getBrokerName(), e); } } return vmConnectorURI; }
/** * Create a view of a running Broker * @param brokerService */ public MessageBrokerView(BrokerService brokerService){ this.brokerService = brokerService; if (brokerService == null){ throw new NullPointerException("BrokerService is null"); } if (!brokerService.isStarted()){ throw new IllegalStateException("BrokerService " + brokerService.getBrokerName() + " is not started"); } }
public File getBrokerDataDirectory() { String brokerDir = getBrokerName(); return new File(getDataDirectoryFile(), brokerDir); }
public synchronized Scheduler getScheduler() { if (this.scheduler==null) { this.scheduler = new Scheduler("ActiveMQ Broker["+getBrokerName()+"] Scheduler"); try { this.scheduler.start(); } catch (Exception e) { LOG.error("Failed to start Scheduler", e); } } return this.scheduler; }
/** * @param brokerName * @return the BrokerService */ public BrokerService lookup(String brokerName) { BrokerService result = null; synchronized (mutex) { result = brokers.get(brokerName); if (result == null && brokerName != null && brokerName.equals(BrokerService.DEFAULT_BROKER_NAME)) { result = findFirst(); if (result != null) { LOG.warn("Broker localhost not started so using {} instead", result.getBrokerName()); } } if (result == null && (brokerName==null || brokerName.isEmpty() || brokerName.equals("null"))){ result = findFirst(); } } return result; }
protected void stopBroker() { // we can no longer keep the lock so lets fail LOG.error("{}, no longer able to keep the exclusive lock so giving up being a master", brokerService.getBrokerName()); try { if( brokerService.isRestartAllowed() ) { brokerService.requestRestart(); } brokerService.stop(); } catch (Exception e) { LOG.warn("Failure occurred while stopping broker"); } }
public String getLeaseHolderId() { if (leaseHolderId == null) { if (lockable.getBrokerService() != null) { leaseHolderId = lockable.getBrokerService().getBrokerName(); } } return leaseHolderId; }
/** * Create a view of a running Broker * @param brokerName */ public MessageBrokerView(String brokerName){ this.brokerService = BrokerRegistry.getInstance().lookup(brokerName); if (brokerService == null){ throw new NullPointerException("BrokerService is null"); } if (!brokerService.isStarted()){ throw new IllegalStateException("BrokerService " + brokerService.getBrokerName() + " is not started"); } }
public TaskRunnerFactory getTaskRunnerFactory() { if (this.taskRunnerFactory == null) { this.taskRunnerFactory = new TaskRunnerFactory("ActiveMQ BrokerService["+getBrokerName()+"] Task", getTaskRunnerPriority(), true, 1000, isDedicatedTaskRunner()); this.taskRunnerFactory.setThreadClassLoader(this.getClass().getClassLoader()); } return this.taskRunnerFactory; }
protected ObjectName createBrokerObjectName() throws MalformedObjectNameException { return BrokerMBeanSupport.createBrokerObjectName(getManagementContext().getJmxDomainName(), getBrokerName()); }
BrokerSubscriptionInfo subInfo = brokerSubscriptionInfo; LOG.debug("Received Remote BrokerSubscriptionInfo on {} from {}", brokerService.getBrokerName(), subInfo.getBrokerName());
/** * @returns the ObjectName of the Connection that created this subscription */ @Override public ObjectName getConnection() { ObjectName result = null; if (clientId != null && subscription != null) { ConnectionContext ctx = subscription.getContext(); if (ctx != null && ctx.getBroker() != null && ctx.getBroker().getBrokerService() != null) { BrokerService service = ctx.getBroker().getBrokerService(); ManagementContext managementCtx = service.getManagementContext(); if (managementCtx != null) { try { ObjectName query = createConnectionQuery(managementCtx, service.getBrokerName()); Set<ObjectName> names = managementCtx.queryNames(query, null); if (names.size() == 1) { result = names.iterator().next(); } } catch (Exception e) { } } } } return result; }
persistenceAdapterToStart.setBrokerName(getBrokerName()); LOG.info("Using Persistence Adapter: {}", persistenceAdapterToStart); if (deleteAllMessagesOnStartup) {
public void startNetworkConnector(final NetworkConnector connector, final Set<ActiveMQDestination> durableDestinations, final ThreadPoolExecutor networkConnectorStartExecutor) throws Exception { connector.setBrokerName(getBrokerName());
connector.setBrokerName(getBrokerService().getBrokerName()); connector.setDurableDestinations(getBrokerService().getBroker().getDurableDestinations());
remoteBrokerName = remoteBrokerInfo.getBrokerName(); if (configuration.isUseBrokerNamesAsIdSeed()) { idGenerator = new IdGenerator(brokerService.getBrokerName() + "->" + remoteBrokerName);
LOG.info("Apache ActiveMQ {} ({}, {}) is starting", new Object[]{ getBrokerVersion(), getBrokerName(), brokerId }); broker.start(); LOG.info("Apache ActiveMQ {} ({}, {}) started", new Object[]{ getBrokerVersion(), getBrokerName(), brokerId}); LOG.info("For help or more information please see: http://activemq.apache.org");
protected Broker createRegionBroker(DestinationInterceptor destinationInterceptor) throws IOException { RegionBroker regionBroker; if (isUseJmx()) { try { regionBroker = new ManagedRegionBroker(this, getManagementContext(), getBrokerObjectName(), getTaskRunnerFactory(), getConsumerSystemUsage(), destinationFactory, destinationInterceptor,getScheduler(),getExecutor()); } catch(MalformedObjectNameException me){ LOG.warn("Cannot create ManagedRegionBroker due " + me.getMessage(), me); throw new IOException(me); } } else { regionBroker = new RegionBroker(this, getTaskRunnerFactory(), getConsumerSystemUsage(), destinationFactory, destinationInterceptor,getScheduler(),getExecutor()); } destinationFactory.setRegionBroker(regionBroker); regionBroker.setKeepDurableSubsActive(keepDurableSubsActive); regionBroker.setBrokerName(getBrokerName()); regionBroker.getDestinationStatistics().setEnabled(enableStatistics); regionBroker.setAllowTempAutoCreationOnSend(isAllowTempAutoCreationOnSend()); if (brokerId != null) { regionBroker.setBrokerId(brokerId); } return regionBroker; }