本文整理汇总了Java中org.apache.activemq.broker.BrokerService.setTmpDataDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java BrokerService.setTmpDataDirectory方法的具体用法?Java BrokerService.setTmpDataDirectory怎么用?Java BrokerService.setTmpDataDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.activemq.broker.BrokerService
的用法示例。
在下文中一共展示了BrokerService.setTmpDataDirectory方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public void run() {
try {
BrokerService broker = new BrokerService();
synchronized (this) {
broker.setPersistenceAdapter(new MemoryPersistenceAdapter());
broker.setTmpDataDirectory(new File("./target"));
broker.addConnector(brokerUrl);
broker.start();
Thread.sleep(200);
notifyAll();
}
synchronized (this) {
while (!shutdownBroker) {
wait(1000);
}
}
broker.stop();
broker = null;
} catch (Exception e) {
exception = e;
e.printStackTrace();
}
}
示例2: run
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public void run() {
try {
BrokerService broker = new BrokerService();
synchronized (this) {
broker.setPersistenceAdapter(new MemoryPersistenceAdapter());
broker.setTmpDataDirectory(new File("./target"));
broker.addConnector(brokerUrl);
broker.start();
Thread.sleep(200);
notifyAll();
}
synchronized (this) {
while (!shutdownBroker) {
wait(1000);
}
}
broker.stop();
} catch (Exception e) {
exception = e;
e.printStackTrace();
}
}
示例3: setUp
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
baseDir = Files.createTempDir();
tmpDir = new File(baseDir, "tmp");
dataDir = new File(baseDir, "data");
Assert.assertTrue(tmpDir.mkdir());
passwordFile = new File(baseDir, "password");
Files.write(PASSWORD.getBytes(StandardCharsets.UTF_8), passwordFile);
broker = new BrokerService();
broker.addConnector(BROKER_BIND_URL);
broker.setTmpDataDirectory(tmpDir);
broker.setDataDirectoryFile(dataDir);
List<AuthenticationUser> users = Lists.newArrayList();
users.add(new AuthenticationUser(USERNAME, PASSWORD, ""));
SimpleAuthenticationPlugin authentication = new SimpleAuthenticationPlugin(users);
broker.setPlugins(new BrokerPlugin[]{authentication});
broker.start();
basicConfig = new BasicConfig();
credentialsConfig = new CredentialsConfig();
dataFormatConfig = new DataParserFormatConfig();
messageConfig = new MessageConfig();
jmsSourceConfig = new JmsSourceConfig();
credentialsConfig.useCredentials = true;
credentialsConfig.username = () -> USERNAME;
credentialsConfig.password = () -> PASSWORD;
dataFormat = DataFormat.JSON;
dataFormatConfig.removeCtrlChars = true;
jmsSourceConfig.initialContextFactory = INITIAL_CONTEXT_FACTORY;
jmsSourceConfig.connectionFactory = CONNECTION_FACTORY;
jmsSourceConfig.destinationName = JNDI_PREFIX + DESTINATION_NAME;
jmsSourceConfig.providerURL = BROKER_BIND_URL;
// Create a connection and start
ConnectionFactory factory = new ActiveMQConnectionFactory(USERNAME,
PASSWORD, BROKER_BIND_URL);
connection = factory.createConnection();
connection.start();
}
示例4: setUp
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
baseDir = Files.createTempDir();
tmpDir = new File(baseDir, "tmp");
dataDir = new File(baseDir, "data");
Assert.assertTrue(tmpDir.mkdir());
passwordFile = new File(baseDir, "password");
Files.write(PASSWORD.getBytes(StandardCharsets.UTF_8), passwordFile);
broker = new BrokerService();
broker.addConnector(BROKER_BIND_URL);
broker.setTmpDataDirectory(tmpDir);
broker.setDataDirectoryFile(dataDir);
List<AuthenticationUser> users = Lists.newArrayList();
users.add(new AuthenticationUser(USERNAME, PASSWORD, ""));
SimpleAuthenticationPlugin authentication = new SimpleAuthenticationPlugin(users);
broker.setPlugins(new BrokerPlugin[]{authentication});
broker.start();
credentialsConfig = new CredentialsConfig();
dataFormatConfig = new DataGeneratorFormatConfig();
jmsTargetConfig = new JmsTargetConfig();
credentialsConfig.useCredentials = true;
credentialsConfig.username = () -> USERNAME;
credentialsConfig.password = () -> PASSWORD;
jmsTargetConfig.destinationName = JNDI_PREFIX + DESTINATION_NAME;
jmsTargetConfig.initialContextFactory = INITIAL_CONTEXT_FACTORY;
jmsTargetConfig.connectionFactory = CONNECTION_FACTORY;
jmsTargetConfig.providerURL = BROKER_BIND_URL;
// Create a connection and start
ConnectionFactory factory = new ActiveMQConnectionFactory(USERNAME,
PASSWORD, BROKER_BIND_URL);
connection = factory.createConnection();
connection.start();
}
示例5: setup
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Before
public void setup() throws Exception {
baseDir = Files.createTempDir();
tmpDir = new File(baseDir, "tmp");
dataDir = new File(baseDir, "data");
Assert.assertTrue(tmpDir.mkdir());
passwordFile = new File(baseDir, "password");
Files.write(PASSWORD.getBytes(Charsets.UTF_8), passwordFile);
broker = new BrokerService();
broker.addConnector(BROKER_BIND_URL);
broker.setTmpDataDirectory(tmpDir);
broker.setDataDirectoryFile(dataDir);
List<AuthenticationUser> users = Lists.newArrayList();
users.add(new AuthenticationUser(USERNAME, PASSWORD, ""));
SimpleAuthenticationPlugin authentication = new SimpleAuthenticationPlugin(users);
broker.setPlugins(new BrokerPlugin[]{authentication});
broker.start();
context = new Context();
context.put(JMSSourceConfiguration.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY);
context.put(JMSSourceConfiguration.PROVIDER_URL, BROKER_BIND_URL);
context.put(JMSSourceConfiguration.DESTINATION_NAME, DESTINATION_NAME);
context.put(JMSSourceConfiguration.USERNAME, USERNAME);
context.put(JMSSourceConfiguration.PASSWORD_FILE, passwordFile.getAbsolutePath());
events = Lists.newArrayList();
source = new JMSSource();
source.setName("JMSSource-" + UUID.randomUUID());
ChannelProcessor channelProcessor = mock(ChannelProcessor.class);
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
events.addAll((List<Event>)invocation.getArguments()[0]);
return null;
}
}).when(channelProcessor).processEventBatch(any(List.class));
source.setChannelProcessor(channelProcessor);
}