当前位置: 首页>>代码示例>>Java>>正文


Java BrokerService.setPersistenceAdapter方法代码示例

本文整理汇总了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");
}
 
开发者ID:apache,项目名称:beam,代码行数:27,代码来源:JmsIOTest.java

示例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();
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:24,代码来源:JmsBroker.java

示例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();
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:23,代码来源:JmsBroker.java

示例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);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:EmbeddedActiveMQBroker.java

示例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;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:24,代码来源:JdbcDurableSubDupTest.java

示例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();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:22,代码来源:mKahaDbQueueMasterSlaveTest.java

示例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;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:19,代码来源:BrokerNetworkWithStuckMessagesTest.java

示例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);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:26,代码来源:CheckDuplicateMessagesOnDuplexTest.java

示例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);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:26,代码来源:NumberOfDestinationsTest.java

示例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;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:14,代码来源:JaxRsSpringEndpointTests.java

示例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;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:15,代码来源:JaxRsProgramaticTests.java

示例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;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:15,代码来源:JaxRsOneWayTests.java

示例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();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:28,代码来源:DbRestartJDBCQueueTest.java

示例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;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:9,代码来源:DurableSubscriptionReactivationTest.java

示例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


注:本文中的org.apache.activemq.broker.BrokerService.setPersistenceAdapter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。