@Activate protected void activate(ComponentContext componentContext) throws Exception { LOG.info("Starting Activation of AMQ Broker "); try { Dictionary<?, ?> properties = componentContext.getProperties(); BundleContext bundleContext = componentContext.getBundleContext(); String brokerUrl = (String) properties.get(ACTIVEMQ_BROKER_URL); broker = new BrokerService(); // generate a full path String slingHome = bundleContext.getProperty("sling.home"); String dataPath = slingHome + "/activemq-data"; LOG.info("Setting Data Path to [{}] [{}] ", new Object[] {slingHome, dataPath}); broker.setDataDirectory(dataPath); String federatedBrokerUrl = (String) properties.get(ACTIVEMQ_FEDERATED_BROKER_URL); if (federatedBrokerUrl != null && federatedBrokerUrl.length() > 0) { LOG.info("Federating ActiveMQ [" + federatedBrokerUrl + "]"); NetworkConnector connector = broker.addNetworkConnector(federatedBrokerUrl); connector.setDuplex(true); } // configure the broker LOG.info("Adding ActiveMQ connector [" + brokerUrl + "]"); broker.addConnector(brokerUrl); broker.start(); } catch (Exception e) { LOG.info(e.getMessage(), e); throw e; } }
private void bridgeAndConfigureBrokers(String local, String remote) throws Exception { NetworkConnector bridge = bridgeBrokers(local, remote, false, 1, false); bridge.setDecreaseNetworkConsumerPriority(true); bridge.setDuplex(true); }