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