本文整理汇总了Java中org.apache.activemq.broker.BrokerService.setDataDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java BrokerService.setDataDirectory方法的具体用法?Java BrokerService.setDataDirectory怎么用?Java BrokerService.setDataDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.activemq.broker.BrokerService
的用法示例。
在下文中一共展示了BrokerService.setDataDirectory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
private boolean startBroker() {
try {
log.info("JMSServerController: Preparing to start JMS Broker: " );
broker = new BrokerService();
// configure the broker
broker.setBrokerName("myBroker1");
log.info(broker.getBrokerDataDirectory());
broker.setDataDirectory(System.getProperty(FrameworkConstants.CARBON_HOME) +
File.separator + broker.getBrokerDataDirectory());
broker.setTransportConnectors(getTCPConnectors());
broker.setPersistent(true);
broker.start();
log.info("JMSServerController: Broker is Successfully started. continuing tests");
return true;
} catch (Exception e) {
log.error(
"JMSServerController: There was an error starting JMS broker: ", e);
return false;
}
}
示例2: configureBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Override
protected void configureBroker(BrokerService broker) throws Exception {
broker.setUseJmx(true);
broker.setPersistent(true);
broker.setDataDirectory("target/activemq-data");
broker.deleteAllMessages();
broker.setAdvisorySupport(true);
broker.addConnector(brokerUri);
// configure expiration rate
ActiveMQQueue queueName = new ActiveMQQueue(">");
PolicyEntry entry = new PolicyEntry();
entry.setDestination(queueName);
entry.setExpireMessagesPeriod(1000);
PolicyMap policyMap = new PolicyMap();
policyMap.put(queueName, entry);
broker.setDestinationPolicy(policyMap);
}
示例3: createBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
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;
}
示例4: createBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
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;
}
示例5: setInitialConfigurations
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
/**
* Helper method to set initial broker configurations.
*
* @throws Exception if there is an error setting TransportConnectors
*/
private void setInitialConfigurations() throws Exception {
log.info("JMSServerController: Preparing to start JMS Broker: " + serverName);
broker = new BrokerService();
broker.setBrokerName(serverName);
log.info(broker.getBrokerDataDirectory());
broker.setDataDirectory(System.getProperty(FrameworkConstants.CARBON_HOME) + File.separator
+ broker.getBrokerDataDirectory());
broker.setTransportConnectors(transportConnectors);
broker.setPersistent(true);
}
示例6: setupJmsBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
private BrokerService setupJmsBroker() throws IOException, URISyntaxException, Exception
{
//
// we want to connect to an independently running JMS broker.
final BrokerService broker = new BrokerService();
broker.setPersistenceAdapter(new MemoryPersistenceAdapter());
broker.setDataDirectory("target/activemq-data");
final TransportConnector connector = new TransportConnector();
connector.setUri(new URI("tcp://localhost:61616"));
broker.addConnector(connector);
broker.start();
return broker;
}
示例7: setupJmsBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
private BrokerService setupJmsBroker() throws IOException, URISyntaxException, Exception
{
//
// we want to connect to an independently running JMS broker.
final BrokerService broker = new BrokerService();
broker.setPersistenceAdapter(new MemoryPersistenceAdapter());
broker.setDataDirectory("target/activemq-data");
final TransportConnector connector = new TransportConnector();
connector.setUri(new URI(JMS_URL));
broker.addConnector(connector);
broker.start();
return broker;
}
示例8: createJmsBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
private BrokerService createJmsBroker() throws IOException, URISyntaxException, Exception
{
//
// we want to connect to an independently running JMS broker.
final BrokerService broker = new BrokerService();
broker.setPersistenceAdapter(new MemoryPersistenceAdapter());
broker.setDataDirectory("target/activemq-data");
final TransportConnector connector = new TransportConnector();
connector.setUri(new URI(JMS_URL));
broker.addConnector(connector);
broker.start();
return broker;
}
示例9: JMSBrokerService
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public JMSBrokerService(String url) throws Exception {
System.setProperty(JMSTestConstants.ACTIVEMQ_LOGIN_CONFIG,
getClass().getClassLoader().getResource(JMSTestConstants.ACTIVEMQ_LOGIN_CONFIG_DIR).getPath());
broker = new BrokerService();
broker.setDataDirectory(JMSTestConstants.TEST_LOG_DIR);
broker.setBrokerName(BROKER_NAME);
broker.addConnector(url);
broker.setPlugins(new BrokerPlugin[] { new JaasAuthenticationPlugin() });
}
示例10: createBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Override
protected BrokerService createBroker() throws Exception {
BrokerService broker = super.createBroker();
broker.setPersistent(true);
broker.setBrokerName("local");
broker.setDataDirectory("target/activemq-data");
broker.setDeleteAllMessagesOnStartup(true);
TransportConnector tc = broker.addConnector(getDefaultMQTTTransportConnectorUri());
localBrokerMQTTPort = tc.getConnectUri().getPort();
return broker;
}
示例11: createRemoteBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Override
protected BrokerService createRemoteBroker(PersistenceAdapter persistenceAdapter) throws Exception {
BrokerService broker = super.createRemoteBroker(persistenceAdapter);
broker.setPersistent(true);
broker.setDeleteAllMessagesOnStartup(true);
broker.setDataDirectory("target/activemq-data");
TransportConnector tc = broker.addConnector(getDefaultMQTTTransportConnectorUri());
remoteBrokerMQTTPort = tc.getConnectUri().getPort();
return broker;
}
示例12: createBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
private BrokerService createBroker(String listenPort, String dataDir) throws Exception {
BrokerService broker = new BrokerService();
broker.setUseJmx(false);
broker.getManagementContext().setCreateConnector(false);
broker.setBrokerName("Broker_Shared");
// lazy create transport connector on start completion
TransportConnector connector = new TransportConnector();
connector.setUri(new URI("tcp://localhost:" + listenPort));
broker.addConnector(connector);
broker.setDataDirectory(dataDir);
return broker;
}
示例13: createBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
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;
}
示例14: createBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@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;
}
示例15: startBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
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();
}