本文整理匯總了Java中org.apache.activemq.broker.BrokerService.setPersistenceAdapter方法的典型用法代碼示例。如果您正苦於以下問題:Java BrokerService.setPersistenceAdapter方法的具體用法?Java BrokerService.setPersistenceAdapter怎麽用?Java BrokerService.setPersistenceAdapter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.activemq.broker.BrokerService
的用法示例。
在下文中一共展示了BrokerService.setPersistenceAdapter方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: startBroker
import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
@Before
public void startBroker() throws Exception {
broker = new BrokerService();
broker.setUseJmx(false);
broker.setPersistenceAdapter(new MemoryPersistenceAdapter());
broker.addConnector(BROKER_URL);
broker.setBrokerName("localhost");
broker.setPopulateJMSXUserID(true);
broker.setUseAuthenticatedPrincipalForJMSXUserID(true);
// enable authentication
List<AuthenticationUser> users = new ArrayList<>();
// username and password to use to connect to the broker.
// This user has users privilege (able to browse, consume, produce, list destinations)
users.add(new AuthenticationUser(USERNAME, PASSWORD, "users"));
SimpleAuthenticationPlugin plugin = new SimpleAuthenticationPlugin(users);
BrokerPlugin[] plugins = new BrokerPlugin[]{ plugin };
broker.setPlugins(plugins);
broker.start();
// create JMS connection factory
connectionFactory = new ActiveMQConnectionFactory(BROKER_URL);
connectionFactoryWithoutPrefetch =
new ActiveMQConnectionFactory(BROKER_URL + "?jms.prefetchPolicy.all=0");
}
示例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();
broker = null;
} catch (Exception e) {
exception = e;
e.printStackTrace();
}
}
示例3: 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();
}
}
示例4: EmbeddedActiveMQBroker
import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
public EmbeddedActiveMQBroker(String brokerId) {
if ((brokerId == null) || (brokerId.isEmpty())) {
throw new IllegalArgumentException("brokerId is empty");
}
this.brokerId = brokerId;
tcpConnectorUri = "tcp://localhost:" + AvailablePortFinder.getNextAvailable();
brokerService = new BrokerService();
brokerService.setBrokerId(brokerId);
brokerService.setPersistent(false);
brokerService.setUseJmx(false);
try {
brokerService.setPersistenceAdapter(new MemoryPersistenceAdapter());
brokerService.addConnector(tcpConnectorUri);
} catch (Exception e) {
throw new RuntimeException("Problem creating brokerService", e);
}
}
示例5: startBroker
import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
@Before
public void startBroker() throws Exception {
exceptions.clear();
for (int i = 0; i < MAX_MESSAGES; i++) {
dupChecker[i] = 0;
}
broker = new BrokerService();
broker.setAdvisorySupport(false);
broker.setPersistenceAdapter(new JDBCPersistenceAdapter());
PolicyEntry policyEntry = new PolicyEntry();
policyEntry.setMaxAuditDepth(3000);
policyEntry.setMaxPageSize(150);
policyEntry.setPrioritizedMessages(true);
PolicyMap policyMap = new PolicyMap();
policyMap.setDefaultEntry(policyEntry);
broker.setDestinationPolicy(policyMap);
broker.addConnector("tcp://localhost:0");
broker.setDeleteAllMessagesOnStartup(true);
broker.start();
broker.waitUntilStarted();
url = broker.getTransportConnectors().get(0).getConnectUri().toString() + "?" + urlOptions;
}
示例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: createRemoteBroker
import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
protected BrokerService createRemoteBroker() throws Exception {
remoteBroker = new BrokerService();
remoteBroker.setBrokerName("remotehost");
remoteBroker.setUseJmx(true);
remoteBroker.setPersistenceAdapter(null);
remoteBroker.setPersistent(false);
remoteConnector = createRemoteConnector();
remoteBroker.addConnector(remoteConnector);
configureBroker(remoteBroker);
remoteBroker.start();
remoteBroker.waitUntilStarted();
remoteBroker.getManagementContext().setConnectorPort(2222);
brokers.put(remoteBroker.getBrokerName(), remoteBroker);
return remoteBroker;
}
示例8: createRemoteBroker
import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
private void createRemoteBroker() throws Exception {
remoteBroker = new BrokerService();
remoteBroker.setBrokerName("REMOTE");
remoteBroker.setUseJmx(true);
remoteBroker.setSchedulePeriodForDestinationPurge(5000);
ManagementContext managementContext = new ManagementContext();
managementContext.setCreateConnector(false);
remoteBroker.setManagementContext(managementContext);
PersistenceAdapter persistenceAdapter = persistenceAdapterFactory("target/remote");
remoteBroker.setPersistenceAdapter(persistenceAdapter);
List<NetworkConnector> networkConnectors = new ArrayList<>();
DiscoveryNetworkConnector networkConnector = new DiscoveryNetworkConnector();
networkConnector.setName("to local");
// set maxInactivityDuration to 0, otherwise the broker restarts while you are in the debugger
networkConnector.setUri(URI.create("static://(tcp://127.0.0.1:23539?wireFormat.maxInactivityDuration=0)"));
networkConnector.setDuplex(true);
//networkConnector.setNetworkTTL(5);
//networkConnector.setDynamicOnly(true);
networkConnector.setAlwaysSyncSend(true);
networkConnector.setDecreaseNetworkConsumerPriority(false);
networkConnector.setPrefetchSize(1);
networkConnector.setCheckDuplicateMessagesOnDuplex(true);
networkConnectors.add(networkConnector);
remoteBroker.setNetworkConnectors(networkConnectors);
}
示例9: configureBroker
import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
protected void configureBroker(BrokerService answer) throws Exception {
File dataFileDir = new File("target/test-amq-data/perfTest/kahadb");
KahaDBPersistenceAdapter kaha = new KahaDBPersistenceAdapter();
kaha.setDirectory(dataFileDir);
//answer.setUseJmx(false);
// The setEnableJournalDiskSyncs(false) setting is a little dangerous right now, as I have not verified
// what happens if the index is updated but a journal update is lost.
// Index is going to be in consistent, but can it be repaired?
//kaha.setEnableJournalDiskSyncs(false);
// Using a bigger journal file size makes he take fewer spikes as it is not switching files as often.
//kaha.setJournalMaxFileLength(1024*100);
// small batch means more frequent and smaller writes
//kaha.setIndexWriteBatchSize(100);
// do the index write in a separate thread
//kaha.setEnableIndexWriteAsync(true);
answer.setPersistenceAdapter(kaha);
answer.setAdvisorySupport(false);
answer.setEnableStatistics(false);
answer.addConnector(bindAddress);
answer.setDeleteAllMessagesOnStartup(true);
}
示例10: 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;
}
示例11: 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;
}
示例12: 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;
}
示例13: 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();
}
示例14: createBroker
import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
@Override
protected BrokerService createBroker() throws Exception {
BrokerService answer = super.createBroker();
answer.setKeepDurableSubsActive(keepDurableSubsActive);
answer.setPersistenceAdapter(new JDBCPersistenceAdapter());
answer.setDeleteAllMessagesOnStartup(true);
return answer;
}
示例15: configurePersistenceAdapter
import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
@Override
protected void configurePersistenceAdapter(BrokerService broker) throws IOException {
File dataFileDir = new File("target/test-amq-data/leveldb/" + broker.getBrokerName());
LevelDBStore kaha = new LevelDBStore();
kaha.setDirectory(dataFileDir);
broker.setPersistenceAdapter(kaha);
}
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:8,代碼來源:SingleBrokerVirtualDestinationsWithWildcardLevelDBTest.java