Java Code Examples for org.apache.activemq.broker.jmx.ManagementContext#setCreateConnector()
The following examples show how to use
org.apache.activemq.broker.jmx.ManagementContext#setCreateConnector() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CheckDuplicateMessagesOnDuplexTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
private void createLocalBroker() throws Exception { localBroker = new BrokerService(); localBroker.setBrokerName("LOCAL"); localBroker.setUseJmx(true); localBroker.setSchedulePeriodForDestinationPurge(5000); ManagementContext managementContext = new ManagementContext(); managementContext.setCreateConnector(false); localBroker.setManagementContext(managementContext); PersistenceAdapter persistenceAdapter = persistenceAdapterFactory("target/local"); localBroker.setPersistenceAdapter(persistenceAdapter); List<TransportConnector> transportConnectors = new ArrayList<>(); DebugTransportFactory tf = new DebugTransportFactory(); TransportServer transport = tf.doBind(URI.create("nio://127.0.0.1:23539")); TransportConnector transportConnector = new TransportConnector(transport); transportConnector.setName("tc"); transportConnector.setAuditNetworkProducers(true); transportConnectors.add(transportConnector); localBroker.setTransportConnectors(transportConnectors); }
Example 2
Source File: CheckDuplicateMessagesOnDuplexTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
private void createRemoteBroker() throws Exception { remoteBroker = new BrokerService(); remoteBroker.setBrokerName("REMOTE"); remoteBroker.setUseJmx(true); remoteBroker.setSchedulePeriodForDestinationPurge(5000); ManagementContext managementContext = new ManagementContext(); managementContext.setCreateConnector(false); remoteBroker.setManagementContext(managementContext); PersistenceAdapter persistenceAdapter = persistenceAdapterFactory("target/remote"); remoteBroker.setPersistenceAdapter(persistenceAdapter); List<NetworkConnector> networkConnectors = new ArrayList<>(); DiscoveryNetworkConnector networkConnector = new DiscoveryNetworkConnector(); networkConnector.setName("to local"); // set maxInactivityDuration to 0, otherwise the broker restarts while you are in the debugger networkConnector.setUri(URI.create("static://(tcp://127.0.0.1:23539?wireFormat.maxInactivityDuration=0)")); networkConnector.setDuplex(true); //networkConnector.setNetworkTTL(5); //networkConnector.setDynamicOnly(true); networkConnector.setAlwaysSyncSend(true); networkConnector.setDecreaseNetworkConsumerPriority(false); networkConnector.setPrefetchSize(1); networkConnector.setCheckDuplicateMessagesOnDuplex(true); networkConnectors.add(networkConnector); remoteBroker.setNetworkConnectors(networkConnectors); }
Example 3
Source File: EmbeddedActiveMQ.java From james-project with Apache License 2.0 | 6 votes |
private void launchEmbeddedBroker(FileSystem fileSystem) throws Exception { brokerService = new BrokerService(); brokerService.setBrokerName(BROKER_NAME); brokerService.setUseJmx(false); brokerService.setPersistent(true); brokerService.setDataDirectoryFile(fileSystem.getFile(BROCKERS_LOCATION)); brokerService.setUseShutdownHook(false); brokerService.setSchedulerSupport(false); brokerService.setBrokerId(BROKER_ID); String[] uris = {BROCKER_URI}; brokerService.setTransportConnectorURIs(uris); ManagementContext managementContext = new ManagementContext(); managementContext.setCreateConnector(false); brokerService.setManagementContext(managementContext); brokerService.setPersistenceAdapter(persistenceAdapter); BrokerPlugin[] brokerPlugins = {new StatisticsBrokerPlugin()}; brokerService.setPlugins(brokerPlugins); String[] transportConnectorsURIs = {BROCKER_URI}; brokerService.setTransportConnectorURIs(transportConnectorsURIs); brokerService.start(); LOGGER.info("Started embedded activeMq"); }
Example 4
Source File: Main.java From activemq-artemis with Apache License 2.0 | 4 votes |
/** * @param args */ public static void main(String[] args) { try { BrokerService broker = new BrokerService(); broker.setPersistent(false); // String brokerDir = "xbean:...; // System.setProperty("activemq.base", brokerDir); // BrokerService broker = BrokerFactory.createBroker(new URI(brokerDir + "/activemq.xml")); // for running on Java 5 without mx4j ManagementContext managementContext = broker.getManagementContext(); managementContext.setFindTigerMbeanServer(true); managementContext.setUseMBeanServer(true); managementContext.setCreateConnector(false); broker.setUseJmx(true); // broker.setPlugins(new BrokerPlugin[] { new // ConnectionDotFilePlugin(), new UDPTraceBrokerPlugin() }); broker.addConnector("tcp://localhost:61616"); broker.addConnector("stomp://localhost:61613"); broker.start(); // lets publish some messages so that there is some stuff to browse DefaultQueueSender.main(new String[]{"Prices.Equity.IBM"}); DefaultQueueSender.main(new String[]{"Prices.Equity.MSFT"}); // lets create a dummy couple of consumers if (createConsumers) { Connection connection = new ActiveMQConnectionFactory().createConnection(); connection.start(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); session.createConsumer(new ActiveMQQueue("Orders.IBM")); session.createConsumer(new ActiveMQQueue("Orders.MSFT"), "price > 100"); Session session2 = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); session2.createConsumer(new ActiveMQQueue("Orders.MSFT"), "price > 200"); } else { // Lets wait for the broker broker.waitUntilStopped(); } } catch (Exception e) { System.out.println("Failed: " + e); e.printStackTrace(); } }