Java Code Examples for org.apache.activemq.broker.BrokerService#setUseJmx()
The following examples show how to use
org.apache.activemq.broker.BrokerService#setUseJmx() .
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: BrokerNetworkWithStuckMessagesTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
protected BrokerService createBroker() throws Exception { localBroker = new BrokerService(); localBroker.setBrokerName("localhost"); localBroker.setUseJmx(true); localBroker.setPersistenceAdapter(null); localBroker.setPersistent(false); connector = createConnector(); localBroker.addConnector(connector); configureBroker(localBroker); localBroker.start(); localBroker.waitUntilStarted(); localBroker.getManagementContext().setConnectorPort(2221); brokers.put(localBroker.getBrokerName(), localBroker); return localBroker; }
Example 2
Source File: EmbeddedActiveMQBroker.java From camel-cookbook-examples with Apache License 2.0 | 6 votes |
public EmbeddedActiveMQBroker(String brokerId) { Validate.notEmpty(brokerId, "brokerId is empty"); this.brokerId = brokerId; tcpConnectorUri = "tcp://localhost:" + AvailablePortFinder.getNextAvailable(); brokerService = new BrokerService(); brokerService.setBrokerId(brokerId); brokerService.setPersistent(false); brokerService.setUseJmx(false); try { brokerService.setPersistenceAdapter(new MemoryPersistenceAdapter()); brokerService.addConnector(tcpConnectorUri); } catch (Exception e) { throw new RuntimeException("Problem creating brokerService", e); } }
Example 3
Source File: RequestReplyToTopicViaThreeNetworkHopsTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
public EmbeddedTcpBroker(String name, int number) throws Exception { brokerSvc = new BrokerService(); synchronized (this.getClass()) { brokerNum = Next_broker_num; Next_broker_num++; } brokerName = name + number; brokerId = brokerName; brokerSvc.setBrokerName(brokerName); brokerSvc.setBrokerId(brokerId); brokerSvc.setPersistent(false); brokerSvc.setUseJmx(false); port = 60000 + (brokerNum * 10); tcpUrl = "tcp://127.0.0.1:" + Integer.toString(port); fullUrl = tcpUrl + "?jms.watchTopicAdvisories=false"; brokerSvc.addConnector(tcpUrl); }
Example 4
Source File: mKahaDbQueueMasterSlaveTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Override protected void createMaster() throws Exception { master = new BrokerService(); master.setBrokerName("master"); master.addConnector(MASTER_URL); master.setUseJmx(false); master.setPersistent(true); master.setDeleteAllMessagesOnStartup(true); MultiKahaDBPersistenceAdapter mKahaDB = new MultiKahaDBPersistenceAdapter(); List<FilteredKahaDBPersistenceAdapter> adapters = new LinkedList<>(); FilteredKahaDBPersistenceAdapter defaultEntry = new FilteredKahaDBPersistenceAdapter(); defaultEntry.setPersistenceAdapter(new KahaDBPersistenceAdapter()); defaultEntry.setPerDestination(true); adapters.add(defaultEntry); mKahaDB.setFilteredPersistenceAdapters(adapters); master.setPersistenceAdapter(mKahaDB); master.start(); }
Example 5
Source File: NetworkConnectionsTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Override protected void setUp() throws Exception { LOG.info("Setting up LocalBroker"); localBroker = new BrokerService(); localBroker.setBrokerName("LocalBroker"); localBroker.setUseJmx(false); localBroker.setPersistent(false); localBroker.setTransportConnectorURIs(new String[]{LOCAL_BROKER_TRANSPORT_URI}); localBroker.start(); localBroker.waitUntilStarted(); LOG.info("Setting up RemoteBroker"); remoteBroker = new BrokerService(); remoteBroker.setBrokerName("RemoteBroker"); remoteBroker.setUseJmx(false); remoteBroker.setPersistent(false); remoteBroker.setTransportConnectorURIs(new String[]{REMOTE_BROKER_TRANSPORT_URI}); remoteBroker.start(); remoteBroker.waitUntilStarted(); }
Example 6
Source File: NotificationMqttTaskModule.java From hmdm-server with Apache License 2.0 | 6 votes |
private boolean initBrokerService() { if (serverUri == null || serverUri.equals("")) { log.info("MQTT service not initialized (parameter mqtt.server.uri not set)"); return false; } brokerService = new BrokerService(); brokerService.setPersistent(false); brokerService.setUseJmx(false); try { brokerService.addConnector("mqtt://" + serverUri); brokerService.start(); log.info("MQTT notification service started at " + serverUri); } catch (Exception e) { log.error("Failed to create MQTT broker service"); e.printStackTrace(); return false; } return true; }
Example 7
Source File: JMSBrokerSetup.java From cxf with Apache License 2.0 | 6 votes |
public void run() { try { //ContainerWapper container; BrokerService broker = new BrokerService(); synchronized (this) { broker.setPersistenceAdapter(new MemoryPersistenceAdapter()); broker.setTmpDataDirectory(new File("./target")); broker.setPopulateJMSXUserID(true); broker.addConnector(brokerUrl); broker.setUseJmx(false); broker.start(); Thread.sleep(200); notifyAll(); } synchronized (this) { while (!shutdownBroker) { wait(1000); } } broker.stop(); broker = null; } catch (Exception e) { exception = e; e.printStackTrace(); } }
Example 8
Source File: NIOSSLConcurrencyTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override protected void setUp() throws Exception { System.setProperty("javax.net.ssl.trustStore", TRUST_KEYSTORE); System.setProperty("javax.net.ssl.trustStorePassword", PASSWORD); System.setProperty("javax.net.ssl.trustStoreType", KEYSTORE_TYPE); System.setProperty("javax.net.ssl.keyStore", SERVER_KEYSTORE); System.setProperty("javax.net.ssl.keyStoreType", KEYSTORE_TYPE); System.setProperty("javax.net.ssl.keyStorePassword", PASSWORD); broker = new BrokerService(); broker.setPersistent(false); broker.setUseJmx(false); TransportConnector connector = broker.addConnector("nio+ssl://localhost:0?transport.needClientAuth=true&transport.enabledCipherSuites=SSL_RSA_WITH_RC4_128_SHA,SSL_DH_anon_WITH_3DES_EDE_CBC_SHA"); broker.start(); broker.waitUntilStarted(); failed = false; messageData = new byte[MESSAGE_SIZE]; for (int i = 0; i < MESSAGE_SIZE; i++) { messageData[i] = (byte) (i & 0xff); } ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("nio+ssl://localhost:" + connector.getConnectUri().getPort()); connection = factory.createConnection(); for (int i = 0; i < PRODUCER_COUNT; i++) { producerSessions[i] = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); } for (int i = 0; i < CONSUMER_COUNT; i++) { consumerSessions[i] = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); } connection.start(); }
Example 9
Source File: ProxyTestSupport.java From activemq-artemis with Apache License 2.0 | 5 votes |
protected BrokerService createRemoteBroker() throws Exception { BrokerService service = new BrokerService(); service.setBrokerName("broker2"); service.setPersistent(false); service.setUseJmx(false); remoteConnector = service.addConnector(getRemoteURI()); remoteProxyConnector = new ProxyConnector(); remoteProxyConnector.setName("remoteProxy"); remoteProxyConnector.setBind(new URI(getRemoteProxyURI())); remoteProxyConnector.setRemote(new URI("fanout:static://" + getLocalURI())); service.addProxyConnector(remoteProxyConnector); return service; }
Example 10
Source File: AbstractVmJMSTest.java From cxf with Apache License 2.0 | 5 votes |
public static void startBroker(String brokerURI) { broker = new BrokerService(); broker.setPersistent(false); try { broker.setPersistenceAdapter(new MemoryPersistenceAdapter()); broker.setTmpDataDirectory(new File("./target")); broker.setUseJmx(false); broker.addConnector(brokerURI); broker.start(); } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } }
Example 11
Source File: JMSAppenderTest.java From servicemix with Apache License 2.0 | 5 votes |
@BeforeClass public static void setupBroker() throws Exception { broker = new BrokerService(); broker.setPersistent(false); broker.setUseJmx(false); broker.setBrokerName("test.broker"); broker.start(); }
Example 12
Source File: JDBCQueueMasterSlaveTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override protected void createMaster() throws Exception { master = new BrokerService(); master.setBrokerName("master"); master.addConnector(MASTER_URL); master.setUseJmx(false); master.setPersistent(true); master.setDeleteAllMessagesOnStartup(true); JDBCPersistenceAdapter persistenceAdapter = new JDBCPersistenceAdapter(); persistenceAdapter.setDataSource(getExistingDataSource()); configureJdbcPersistenceAdapter(persistenceAdapter); master.setPersistenceAdapter(persistenceAdapter); configureBroker(master); master.start(); }
Example 13
Source File: JmsMessageConsumerTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Before public void startBroker() throws Exception { brokerService = new BrokerService(); brokerService.setPersistent(false); brokerService.setUseJmx(false); brokerService.start(); brokerService.waitUntilStarted(); brokerURI = "vm://localhost?create=false"; }
Example 14
Source File: FailoverClusterTestSupport.java From activemq-artemis with Apache License 2.0 | 5 votes |
protected BrokerService createBroker(String brokerName) throws Exception { BrokerService answer = new BrokerService(); answer.setPersistent(false); answer.setUseJmx(false); answer.setBrokerName(brokerName); answer.setUseShutdownHook(false); return answer; }
Example 15
Source File: ProxyFailoverTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override protected void setUp() throws Exception { startRemoteBroker(true); proxyBroker = new BrokerService(); ProxyConnector connector = new ProxyConnector(); connector.setBind(new URI("tcp://localhost:51618")); connector.setProxyToLocalBroker(false); connector.setRemote(new URI("failover:(tcp://localhost:61616)")); proxyBroker.addProxyConnector(connector); proxyBroker.setPersistent(false); proxyBroker.setUseJmx(false); proxyBroker.start(); proxyBroker.waitUntilStarted(); }
Example 16
Source File: ActiveMQJmsPoolTestSupport.java From pooled-jms with Apache License 2.0 | 5 votes |
protected String createBroker() throws Exception { brokerService = new BrokerService(); brokerService.setDeleteAllMessagesOnStartup(true); brokerService.setPersistent(false); brokerService.setUseJmx(true); brokerService.getManagementContext().setCreateConnector(false); brokerService.getManagementContext().setCreateMBeanServer(false); brokerService.setAdvisorySupport(false); brokerService.setSchedulerSupport(false); brokerService.addConnector("tcp://localhost:0").setName("test"); ArrayList<BrokerPlugin> plugins = new ArrayList<BrokerPlugin>(); List<AuthenticationUser> users = new ArrayList<AuthenticationUser>(); users.add(new AuthenticationUser(USER, USER_PASSWORD, "users")); users.add(new AuthenticationUser(GUEST, USER_PASSWORD, "guests")); users.add(new AuthenticationUser(ADMIN, ADMIN, "admins")); SimpleAuthenticationPlugin authenticationPlugin = new SimpleAuthenticationPlugin(users); authenticationPlugin.setAnonymousAccessAllowed(true); plugins.add(authenticationPlugin); plugins.add(configureAuthorization()); brokerService.setPlugins(plugins.toArray(new BrokerPlugin[2])); brokerService.start(); brokerService.waitUntilStarted(); return brokerService.getTransportConnectorByName("test").getPublishableConnectString(); }
Example 17
Source File: DispatchMultipleConsumersTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override protected void setUp() throws Exception { super.setUp(); broker = new BrokerService(); broker.setPersistent(true); broker.setUseJmx(true); broker.deleteAllMessages(); broker.addConnector("tcp://localhost:0"); broker.start(); broker.waitUntilStarted(); dest = new ActiveMQQueue(destinationName); resetCounters(); brokerURL = broker.getTransportConnectors().get(0).getPublishableConnectString(); }
Example 18
Source File: AbstractElasticSearchActiveMQTest.java From camunda-bpm-elasticsearch with Apache License 2.0 | 5 votes |
protected BrokerService createBroker() { BrokerService brokerService = new BrokerService(); brokerService.setPersistent(false); brokerService.setUseJmx(false); PolicyMap policyMap = new PolicyMap(); PolicyEntry policy = new PolicyEntry(); policy.setConsumersBeforeDispatchStarts(2); policy.setTimeBeforeDispatchStarts(1000); policyMap.setDefaultEntry(policy); brokerService.setDestinationPolicy(policyMap); return brokerService; }
Example 19
Source File: RunBroker.java From activemq-artemis with Apache License 2.0 | 5 votes |
public static void main(String arg[]) { try { KahaDBPersistenceAdapter kahaDB = new KahaDBPersistenceAdapter(); File dataFileDir = new File("target/test-amq-data/perfTest/kahadb"); IOHelper.deleteChildren(dataFileDir); kahaDB.setDirectory(dataFileDir); // The setEnableJournalDiskSyncs(false) setting is a little // dangerous right now, as I have not verified // what happens if the index is updated but a journal update is // lost. // Index is going to be in consistent, but can it be repaired? // kaha.setEnableJournalDiskSyncs(false); // Using a bigger journal file size makes he take fewer spikes as it // is not switching files as often. // kaha.setJournalMaxFileLength(1024*1024*100); // small batch means more frequent and smaller writes kahaDB.setIndexWriteBatchSize(1000); kahaDB.setIndexCacheSize(10000); // do the index write in a separate thread // kahaDB.setEnableIndexWriteAsync(true); BrokerService broker = new BrokerService(); broker.setUseJmx(false); // broker.setPersistenceAdapter(adaptor); broker.setPersistenceAdapter(kahaDB); // broker.setPersistent(false); broker.setDeleteAllMessagesOnStartup(true); broker.addConnector("tcp://0.0.0.0:61616"); broker.start(); System.err.println("Running"); Thread.sleep(Long.MAX_VALUE); } catch (Throwable e) { e.printStackTrace(); } }
Example 20
Source File: BrokerExtension.java From james-project with Apache License 2.0 | 4 votes |
public BrokerExtension() throws Exception { broker = new BrokerService(); broker.setPersistent(false); broker.setUseJmx(false); broker.addConnector("tcp://127.0.0.1:61616"); }