Java Code Examples for org.apache.activemq.broker.BrokerService#setSchedulerSupport()
The following examples show how to use
org.apache.activemq.broker.BrokerService#setSchedulerSupport() .
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: ActiveMQTestBase.java From vertx-proton with Apache License 2.0 | 6 votes |
protected BrokerService createBroker(String name, boolean deleteMessagesOnStartup, Map<String, Integer> portMap) throws Exception { BrokerService brokerService = new BrokerService(); brokerService.setBrokerName(name); brokerService.setDeleteAllMessagesOnStartup(deleteMessagesOnStartup); brokerService.setUseJmx(true); brokerService.getManagementContext().setCreateConnector(false); brokerService.setDataDirectory(DATA_PARENT_DIR + File.separator + "data" + File.separator + name); brokerService.setPersistent(false); brokerService.setSchedulerSupport(false); brokerService.setAdvisorySupport(false); ArrayList<BrokerPlugin> plugins = new ArrayList<BrokerPlugin>(); BrokerPlugin authenticationPlugin = configureAuthentication(); if (authenticationPlugin != null) { plugins.add(authenticationPlugin); } if (!plugins.isEmpty()) { brokerService.setPlugins(plugins.toArray(new BrokerPlugin[0])); } addAdditionalConnectors(brokerService, portMap); return brokerService; }
Example 2
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 3
Source File: IgniteJmsStreamerTest.java From ignite with Apache License 2.0 | 6 votes |
/** * @throws Exception If failed. */ @SuppressWarnings("unchecked") @Override public void beforeTest() throws Exception { grid().<Integer, String>getOrCreateCache(defaultCacheConfiguration()); broker = new BrokerService(); broker.setDeleteAllMessagesOnStartup(true); broker.setPersistent(false); broker.setPersistenceAdapter(null); broker.setPersistenceFactory(null); PolicyMap plcMap = new PolicyMap(); PolicyEntry plc = new PolicyEntry(); plc.setQueuePrefetch(1); broker.setDestinationPolicy(plcMap); broker.getDestinationPolicy().setDefaultEntry(plc); broker.setSchedulerSupport(false); broker.start(true); connFactory = new ActiveMQConnectionFactory(BrokerRegistry.getInstance().findFirst().getVmConnectorURI()); }
Example 4
Source File: QueueOptimizedDispatchExceptionTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Before public void setUp() throws Exception { // Setup and start the broker broker = new BrokerService(); broker.setBrokerName(brokerName); broker.setPersistent(false); broker.setSchedulerSupport(false); broker.setUseJmx(false); broker.setUseShutdownHook(false); broker.addConnector(brokerUrl); // Start the broker broker.start(); broker.waitUntilStarted(); }
Example 5
Source File: JobSchedulerTestSupport.java From activemq-artemis with Apache License 2.0 | 6 votes |
protected BrokerService createBroker(boolean delete) throws Exception { File schedulerDirectory = new File("target/scheduler"); if (delete) { IOHelper.mkdirs(schedulerDirectory); IOHelper.deleteChildren(schedulerDirectory); } BrokerService answer = new BrokerService(); answer.setPersistent(isPersistent()); answer.setDeleteAllMessagesOnStartup(true); answer.setDataDirectory("target"); answer.setSchedulerDirectoryFile(schedulerDirectory); answer.setSchedulerSupport(true); answer.setUseJmx(isUseJmx()); return answer; }
Example 6
Source File: PooledConnectionFailoverTest.java From pooled-jms with Apache License 2.0 | 5 votes |
@Override protected String createBroker() throws Exception { brokerService = new BrokerService(); brokerService.setBrokerName("PooledConnectionSessionCleanupTestBroker"); brokerService.setUseJmx(true); brokerService.getManagementContext().setCreateConnector(false); brokerService.setPersistent(false); brokerService.setSchedulerSupport(false); brokerService.setAdvisorySupport(false); TransportConnector connector = brokerService.addConnector("tcp://0.0.0.0:61626"); brokerService.start(); brokerService.waitUntilStarted(); return "failover:(" + connector.getPublishableConnectString() + ")?maxReconnectAttempts=5"; }
Example 7
Source File: ConsumeUncompressedCompressedMessageTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
protected BrokerService createBroker(boolean delete) throws Exception { BrokerService answer = new BrokerService(); answer.setPersistent(false); answer.setDeleteAllMessagesOnStartup(true); answer.setSchedulerSupport(false); answer.setUseJmx(true); TransportConnector connector = answer.addConnector("tcp://localhost:0"); tcpUri = connector.getConnectUri(); return answer; }
Example 8
Source File: TopicProducerFlowControlTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override protected void setUp() throws Exception { // Setup and start the broker broker = new BrokerService(); broker.setBrokerName(brokerName); broker.setPersistent(false); broker.setSchedulerSupport(false); broker.setUseJmx(false); broker.setUseShutdownHook(false); broker.addConnector(brokerUrl); // Setup the destination policy PolicyMap pm = new PolicyMap(); // Setup the topic destination policy PolicyEntry tpe = new PolicyEntry(); tpe.setTopic(">"); tpe.setMemoryLimit(destinationMemLimit); tpe.setProducerFlowControl(true); tpe.setAdvisoryWhenFull(true); // Setup the topic destination policy PolicyEntry qpe = new PolicyEntry(); qpe.setQueue(">"); qpe.setMemoryLimit(destinationMemLimit); qpe.setProducerFlowControl(true); qpe.setQueuePrefetch(1); qpe.setAdvisoryWhenFull(true); pm.setPolicyEntries(Arrays.asList(new PolicyEntry[]{tpe, qpe})); setDestinationPolicy(broker, pm); // Start the broker broker.start(); broker.waitUntilStarted(); }
Example 9
Source File: KahaDBSchedulerIndexRebuildTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
protected BrokerService createBroker(JobSchedulerStoreImpl scheduler) throws Exception { BrokerService answer = new BrokerService(); answer.setJobSchedulerStore(scheduler); answer.setPersistent(true); answer.setDataDirectory(storeDir.getAbsolutePath()); answer.setSchedulerSupport(true); answer.setUseJmx(false); return answer; }
Example 10
Source File: KahaDBSchedulerMissingJournalLogsTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
protected void createBroker(JobSchedulerStoreImpl scheduler) throws Exception { broker = new BrokerService(); broker.setJobSchedulerStore(scheduler); broker.setPersistent(true); broker.setDataDirectory(storeDir.getAbsolutePath()); broker.setSchedulerSupport(true); broker.setUseJmx(false); }
Example 11
Source File: LostScheduledMessagesTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
private void startBroker() throws Exception { broker = new BrokerService(); broker.setSchedulerSupport(true); broker.setPersistent(true); broker.setDeleteAllMessagesOnStartup(false); broker.setDataDirectory("target"); broker.setSchedulerDirectoryFile(schedulerDirectory); broker.setDataDirectoryFile(messageDirectory); broker.setUseJmx(false); broker.addConnector("vm://localhost"); broker.start(); }
Example 12
Source File: JobSchedulerBrokerShutdownTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override protected BrokerService createBroker() throws Exception { File schedulerDirectory = new File("target/scheduler"); IOHelper.mkdirs(schedulerDirectory); IOHelper.deleteChildren(schedulerDirectory); BrokerService broker = super.createBroker(); broker.setSchedulerSupport(true); broker.setDataDirectory("target"); broker.setSchedulerDirectoryFile(schedulerDirectory); broker.getSystemUsage().getStoreUsage().setLimit(1 * 512); broker.deleteAllMessages(); return broker; }
Example 13
Source File: SchedulerDBVersionTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
protected BrokerService createBroker(JobSchedulerStoreImpl scheduler) throws Exception { BrokerService answer = new BrokerService(); answer.setJobSchedulerStore(scheduler); answer.setPersistent(true); answer.setDataDirectory("target"); answer.setSchedulerSupport(true); answer.setUseJmx(false); return answer; }
Example 14
Source File: JobSchedulerStoreUsageTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override protected BrokerService createBroker() throws Exception { File schedulerDirectory = new File("target/scheduler"); IOHelper.mkdirs(schedulerDirectory); IOHelper.deleteChildren(schedulerDirectory); BrokerService broker = super.createBroker(); broker.setSchedulerSupport(true); broker.setSchedulerDirectoryFile(schedulerDirectory); broker.getSystemUsage().getJobSchedulerUsage().setLimit(7 * 1024); broker.deleteAllMessages(); return broker; }
Example 15
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 16
Source File: PooledConnectionSessionCleanupTest.java From pooled-jms with Apache License 2.0 | 5 votes |
@Override 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.start(); brokerService.waitUntilStarted(); return brokerService.getVmConnectorURI().toString(); }
Example 17
Source File: QpidJmsPoolTestSupport.java From pooled-jms with Apache License 2.0 | 5 votes |
protected BrokerService createBroker() throws Exception { BrokerService brokerService = new BrokerService(); brokerService.setDeleteAllMessagesOnStartup(true); brokerService.setPersistent(false); brokerService.setUseJmx(false); brokerService.setAdvisorySupport(false); brokerService.setSchedulerSupport(false); connectionURI = brokerService.addConnector("amqp://localhost:0").getPublishableConnectString(); brokerService.start(); brokerService.waitUntilStarted(); return brokerService; }
Example 18
Source File: IgniteMqttStreamerTest.java From ignite with Apache License 2.0 | 4 votes |
/** * @throws Exception If failed. */ @SuppressWarnings("unchecked") @Override public void beforeTest() throws Exception { grid().<Integer, String>getOrCreateCache(defaultCacheConfiguration()); // find an available local port try (ServerSocket ss = new ServerSocket(0)) { port = ss.getLocalPort(); } // create the broker broker = new BrokerService(); broker.setDeleteAllMessagesOnStartup(true); broker.setPersistent(false); broker.setPersistenceAdapter(null); broker.setPersistenceFactory(null); PolicyMap plcMap = new PolicyMap(); PolicyEntry plc = new PolicyEntry(); plc.setQueuePrefetch(1); broker.setDestinationPolicy(plcMap); broker.getDestinationPolicy().setDefaultEntry(plc); broker.setSchedulerSupport(false); // add the MQTT transport connector to the broker broker.addConnector("mqtt://localhost:" + port); broker.setStartAsync(false); broker.start(true); // create the broker URL brokerUrl = "tcp://localhost:" + port; // create the client and connect client = new MqttClient(brokerUrl, UUID.randomUUID().toString(), new MemoryPersistence()); client.connect(); // create mqtt streamer dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME); streamer = createMqttStreamer(dataStreamer); }
Example 19
Source File: QpidJmsTestSupport.java From qpid-jms with Apache License 2.0 | 4 votes |
protected BrokerService createBroker(String name, boolean deleteAllMessages, Map<String, Integer> portMap) throws Exception { BrokerService brokerService = new BrokerService(); brokerService.setBrokerName(name); brokerService.setPersistent(isPersistent()); brokerService.setSchedulerSupport(isSchedulerSupport()); brokerService.setAdvisorySupport(isAdvisorySupport()); brokerService.setDeleteAllMessagesOnStartup(deleteAllMessages); brokerService.setUseJmx(true); brokerService.getManagementContext().setCreateConnector(false); brokerService.setDataDirectory("target/" + name); brokerService.setKeepDurableSubsActive(false); if (isPersistent()) { KahaDBStore kaha = new KahaDBStore(); kaha.setDirectory(new File(KAHADB_DIRECTORY + "/" + name)); kaha.setConcurrentStoreAndDispatchQueues(isConcurrentStoreAndDispatchQueues()); kaha.setConcurrentStoreAndDispatchTopics(isConcurrentStoreAndDispatchTopics()); kaha.setCheckpointInterval(TimeUnit.MINUTES.toMillis(5)); brokerService.setPersistenceAdapter(kaha); } configureBrokerPolicies(brokerService); ArrayList<BrokerPlugin> plugins = new ArrayList<BrokerPlugin>(); BrokerPlugin authenticationPlugin = configureAuthentication(); if (authenticationPlugin != null) { plugins.add(authenticationPlugin); } BrokerPlugin authorizationPlugin = configureAuthorization(); if (authorizationPlugin != null) { plugins.add(authorizationPlugin); } addAdditionalBrokerPlugins(plugins); if (!plugins.isEmpty()) { BrokerPlugin[] array = new BrokerPlugin[plugins.size()]; brokerService.setPlugins(plugins.toArray(array)); } addAdditionalConnectors(brokerService, portMap); return brokerService; }