本文整理汇总了Java中org.apache.activemq.broker.BrokerService.setDeleteAllMessagesOnStartup方法的典型用法代码示例。如果您正苦于以下问题:Java BrokerService.setDeleteAllMessagesOnStartup方法的具体用法?Java BrokerService.setDeleteAllMessagesOnStartup怎么用?Java BrokerService.setDeleteAllMessagesOnStartup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.activemq.broker.BrokerService
的用法示例。
在下文中一共展示了BrokerService.setDeleteAllMessagesOnStartup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Before
public void startBroker() throws Exception {
LOG.info("Finding free network port");
try (ServerSocket socket = new ServerSocket(0)) {
port = socket.getLocalPort();
}
LOG.info("Starting ActiveMQ brokerService on {}", port);
brokerService = new BrokerService();
brokerService.setDeleteAllMessagesOnStartup(true);
// use memory persistence for the test: it's faster and don't pollute test folder with KahaDB
brokerService.setPersistent(false);
brokerService.addConnector("mqtt://localhost:" + port);
brokerService.start();
brokerService.waitUntilStarted();
}
示例2: createBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
private void createBroker() throws Exception {
broker = new BrokerService();
broker.setPersistent(false);
broker.setDeleteAllMessagesOnStartup(true);
broker.setUseJmx(true);
connectionUri = broker.addConnector("tcp://localhost:0").getPublishableConnectString();
PolicyEntry policy = new PolicyEntry();
policy.setAdvisoryForFastProducers(true);
policy.setAdvisoryForConsumed(true);
policy.setAdvisoryForDelivery(true);
policy.setAdvisoryForDiscardingMessages(true);
policy.setAdvisoryForSlowConsumers(true);
policy.setAdvisoryWhenFull(true);
policy.setProducerFlowControl(false);
PolicyMap pMap = new PolicyMap();
pMap.setDefaultEntry(policy);
broker.setDestinationPolicy(pMap);
broker.start();
}
示例3: setUp
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
setMaxTestTime(10 * 60 * 1000); // 10 mins
setAutoFail(true);
super.setUp();
broker = new BrokerService();
File testDataDir = new File("target/activemq-data/QueuePurgeTest");
broker.setDataDirectoryFile(testDataDir);
broker.setUseJmx(true);
broker.setDeleteAllMessagesOnStartup(true);
broker.getSystemUsage().getMemoryUsage().setLimit(1024L * 1024 * 64);
KahaDBPersistenceAdapter persistenceAdapter = new KahaDBPersistenceAdapter();
persistenceAdapter.setDirectory(new File(testDataDir, "kahadb"));
broker.setPersistenceAdapter(persistenceAdapter);
broker.addConnector("tcp://localhost:0");
broker.start();
factory = new ActiveMQConnectionFactory(broker.getTransportConnectors().get(0).getConnectUri().toString());
connection = factory.createConnection();
connection.start();
}
示例4: createBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
private BrokerService createBroker() throws Exception {
BrokerService broker = new BrokerService();
broker.setBrokerName("localhost");
broker.setUseJmx(true);
broker.setDeleteAllMessagesOnStartup(true);
broker.addConnector("vm://localhost");
PolicyMap policyMap = new PolicyMap();
PolicyEntry defaultEntry = new PolicyEntry();
defaultEntry.setAdvisoryForSlowConsumers(true);
policyMap.setDefaultEntry(defaultEntry);
broker.setDestinationPolicy(policyMap);
broker.start();
broker.waitUntilStarted();
return broker;
}
示例5: createMaster
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@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);
KahaDBPersistenceAdapter kahaDBPersistenceAdapter = (KahaDBPersistenceAdapter) master.getPersistenceAdapter();
LeaseDatabaseLocker leaseDatabaseLocker = new LeaseDatabaseLocker();
leaseDatabaseLocker.setCreateTablesOnStartup(true);
leaseDatabaseLocker.setDataSource(getExistingDataSource());
leaseDatabaseLocker.setStatements(new Statements());
kahaDBPersistenceAdapter.setLocker(leaseDatabaseLocker);
configureLocker(kahaDBPersistenceAdapter);
configureBroker(master);
master.start();
}
示例6: createMaster
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@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();
}
示例7: createBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
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;
}
示例8: setUp
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
super.setUp();
brokerService = new BrokerService();
brokerService.setDeleteAllMessagesOnStartup(true);
brokerService.setPersistent(false);
brokerService.setUseJmx(false);
brokerService.setAdvisorySupport(false);
brokerService.setSchedulerSupport(false);
brokerService.start();
brokerService.waitUntilStarted();
}
示例9: createBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
protected String createBroker() throws Exception {
brokerService = new BrokerService();
brokerService.setDeleteAllMessagesOnStartup(true);
brokerService.setPersistent(false);
brokerService.setUseJmx(false);
brokerService.setAdvisorySupport(false);
brokerService.setSchedulerSupport(false);
brokerService.start();
brokerService.waitUntilStarted();
return brokerService.getVmConnectorURI().toString();
}
示例10: startBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public void startBroker() throws Exception {
brokerService = new BrokerService();
brokerService.setPersistent(false);
brokerService.setDeleteAllMessagesOnStartup(true);
brokerService.setAdvisorySupport(false);
brokerService.getManagementContext().setCreateConnector(false);
brokerService.getManagementContext().setCreateMBeanServer(false);
brokerService.addConnector("tcp://0.0.0.0:0");
ArrayList<BrokerPlugin> plugins = new ArrayList<BrokerPlugin>();
BrokerPlugin authenticationPlugin = configureAuthentication();
if (authenticationPlugin != null) {
plugins.add(configureAuthorization());
}
BrokerPlugin authorizationPlugin = configureAuthorization();
if (authorizationPlugin != null) {
plugins.add(configureAuthentication());
}
if (!plugins.isEmpty()) {
BrokerPlugin[] array = new BrokerPlugin[plugins.size()];
brokerService.setPlugins(plugins.toArray(array));
}
brokerService.start();
brokerService.waitUntilStarted();
connectionURI = brokerService.getTransportConnectors().get(0).getPublishableConnectString();
}
示例11: createBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
private BrokerService createBroker() throws Exception {
BrokerService broker = new BrokerService();
broker.setBrokerName("localhost");
broker.setUseJmx(false);
broker.setDeleteAllMessagesOnStartup(true);
broker.addConnector("vm://localhost");
broker.start();
broker.waitUntilStarted();
return broker;
}
示例12: setUp
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
setAutoFail(true);
topic = false;
verbose = true;
// startup db
sharedDs = (EmbeddedDataSource) DataSourceServiceSupport.createDataSource(IOHelper.getDefaultDataDirectory());
broker = new BrokerService();
DefaultIOExceptionHandler handler = new DefaultIOExceptionHandler();
handler.setIgnoreSQLExceptions(false);
handler.setStopStartConnectors(true);
broker.setIoExceptionHandler(handler);
broker.addConnector("tcp://localhost:0");
broker.setUseJmx(false);
broker.setPersistent(true);
broker.setDeleteAllMessagesOnStartup(true);
JDBCPersistenceAdapter persistenceAdapter = new JDBCPersistenceAdapter();
persistenceAdapter.setDataSource(sharedDs);
persistenceAdapter.setUseLock(false);
persistenceAdapter.setLockKeepAlivePeriod(500);
persistenceAdapter.getLocker().setLockAcquireSleepInterval(500);
broker.setPersistenceAdapter(persistenceAdapter);
broker.start();
super.setUp();
}
示例13: createBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Override
protected BrokerService createBroker(String brokerName) throws Exception {
BrokerService broker = new BrokerService();
broker.setDeleteAllMessagesOnStartup(true);
broker.setPersistent(true);
broker.setUseJmx(false);
broker.setBrokerName(brokerName);
broker.addConnector(new URI(AUTO_ASSIGN_TRANSPORT));
brokers.put(brokerName, new BrokerItem(broker));
return broker;
}
示例14: createMaster
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@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();
}
示例15: createRestartedBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
private void createRestartedBroker() throws Exception {
broker = new BrokerService();
broker.setBrokerName("durable-broker");
broker.setDeleteAllMessagesOnStartup(false);
broker.setPersistenceAdapter(createPersistenceAdapter());
broker.setPersistent(true);
broker.start();
broker.waitUntilStarted();
connection = createConnection();
}