本文整理匯總了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();
}