• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MemoryPersistenceAdapter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.activemq.store.memory.MemoryPersistenceAdapter的典型用法代码示例。如果您正苦于以下问题:Java MemoryPersistenceAdapter类的具体用法?Java MemoryPersistenceAdapter怎么用?Java MemoryPersistenceAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MemoryPersistenceAdapter类属于org.apache.activemq.store.memory包,在下文中一共展示了MemoryPersistenceAdapter类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: startBroker

import org.apache.activemq.store.memory.MemoryPersistenceAdapter; //导入依赖的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.store.memory.MemoryPersistenceAdapter; //导入依赖的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.store.memory.MemoryPersistenceAdapter; //导入依赖的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.store.memory.MemoryPersistenceAdapter; //导入依赖的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: EmbeddedActiveMQBroker

import org.apache.activemq.store.memory.MemoryPersistenceAdapter; //导入依赖的package包/类
public EmbeddedActiveMQBroker(String brokerId) {
    Validate.notEmpty(brokerId, "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:jkorab,项目名称:camel-devoxx,代码行数:17,代码来源:EmbeddedActiveMQBroker.java


示例6: createPersistenceAdapter

import org.apache.activemq.store.memory.MemoryPersistenceAdapter; //导入依赖的package包/类
protected PersistenceAdapter createPersistenceAdapter() throws IOException {
    if (isPersistent()) {
        PersistenceAdapterFactory fac = getPersistenceFactory();
        if (fac != null) {
            return fac.createPersistenceAdapter();
        } else {
            try {
                String clazz = "org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter";
                PersistenceAdapter adaptor = (PersistenceAdapter)getClass().getClassLoader().loadClass(clazz).newInstance();
                File dir = new File(getBrokerDataDirectory(),"KahaDB");
                adaptor.setDirectory(dir);
                return adaptor;
            } catch (Throwable e) {
                throw IOExceptionSupport.create(e);
            }
        }
    } else {
        return new MemoryPersistenceAdapter();
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:21,代码来源:BrokerService.java


示例7: createBroker

import org.apache.activemq.store.memory.MemoryPersistenceAdapter; //导入依赖的package包/类
private BrokerService createBroker(boolean deleteAllMessages, long expireMessagesPeriod) throws Exception {
   BrokerService broker = new BrokerService();
   broker.setBrokerName("localhost");
   broker.setDestinations(new ActiveMQDestination[]{destination});
   broker.setPersistenceAdapter(new MemoryPersistenceAdapter());

   PolicyEntry defaultPolicy = new PolicyEntry();
   if (useVMCursor) {
      defaultPolicy.setPendingQueuePolicy(new VMPendingQueueMessageStoragePolicy());
   }
   defaultPolicy.setExpireMessagesPeriod(expireMessagesPeriod);
   defaultPolicy.setMaxExpirePageSize(1200);
   PolicyMap policyMap = new PolicyMap();
   policyMap.setDefaultEntry(defaultPolicy);
   broker.setDestinationPolicy(policyMap);
   broker.setDeleteAllMessagesOnStartup(deleteAllMessages);
   broker.addConnector("tcp://localhost:0");
   broker.start();
   broker.waitUntilStarted();
   return broker;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:22,代码来源:ExpiredMessagesTest.java


示例8: setupJmsBroker

import org.apache.activemq.store.memory.MemoryPersistenceAdapter; //导入依赖的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


示例9: setupJmsBroker

import org.apache.activemq.store.memory.MemoryPersistenceAdapter; //导入依赖的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


示例10: createJmsBroker

import org.apache.activemq.store.memory.MemoryPersistenceAdapter; //导入依赖的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


示例11: setPersistenceAdapter

import org.apache.activemq.store.memory.MemoryPersistenceAdapter; //导入依赖的package包/类
/**
 * Sets the persistence adaptor implementation to use for this broker
 *
 * @throws IOException
 */
public void setPersistenceAdapter(PersistenceAdapter persistenceAdapter) throws IOException {
    if (!isPersistent() && ! (persistenceAdapter instanceof MemoryPersistenceAdapter)) {
        LOG.warn("persistent=\"false\", ignoring configured persistenceAdapter: {}", persistenceAdapter);
        return;
    }
    this.persistenceAdapter = persistenceAdapter;
    configureService(this.persistenceAdapter);
    this.persistenceAdapter = registerPersistenceAdapterMBean(persistenceAdapter);
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:15,代码来源:BrokerService.java


示例12: testMemoryConfig

import org.apache.activemq.store.memory.MemoryPersistenceAdapter; //导入依赖的package包/类
@Test
public void testMemoryConfig() throws Exception {
   File journalFile = new File(JOURNAL_ROOT + "testMemoryConfig");
   recursiveDelete(journalFile);

   File derbyFile = new File(DERBY_ROOT + "testMemoryConfig");
   recursiveDelete(derbyFile);

   BrokerService broker;
   broker = createBroker(new FileSystemResource(CONF_ROOT + "memory-example.xml"));

   try {
      assertEquals("Broker Config Error (brokerName)", "brokerMemoryConfigTest", broker.getBrokerName());

      PersistenceAdapter adapter = broker.getPersistenceAdapter();

      assertTrue("Should have created a memory persistence adapter", adapter instanceof MemoryPersistenceAdapter);
      assertTrue("Should have not created a derby directory at " + derbyFile.getAbsolutePath(), !derbyFile.exists());
      assertTrue("Should have not created a journal directory at " + journalFile.getAbsolutePath(), !journalFile.exists());

      LOG.info("Success");
   } finally {
      if (broker != null) {
         broker.stop();
      }
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:28,代码来源:ConfigTest.java


示例13: setUp

import org.apache.activemq.store.memory.MemoryPersistenceAdapter; //导入依赖的package包/类
@Setup @SuppressWarnings("unused")
private void setUp() throws Exception {
    broker = new BrokerService();
    broker.setBrokerName(BROKER_NAME);
    broker.setDataDirectory("target/activemq-data");
    broker.setPersistenceAdapter(new MemoryPersistenceAdapter());
    broker.start();
}
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:9,代码来源:ActiveMQTestEnvironment.java


示例14: testNoDataSource

import org.apache.activemq.store.memory.MemoryPersistenceAdapter; //导入依赖的package包/类
public void testNoDataSource() throws Exception {
    final BrokerService broker = BrokerFactory.createBroker(new URI(getBrokerUri(
        "broker:(tcp://localhost:" + brokerPort + ")?useJmx=false")));
    assertNotNull("broker is null", broker);

    final PersistenceAdapter persistenceAdapter = broker.getPersistenceAdapter();
    assertNotNull("persistenceAdapter is null", persistenceAdapter);

    assertTrue("persistenceAdapter should be an instance of MemoryPersistenceAdapter",
        persistenceAdapter instanceof MemoryPersistenceAdapter);

    stopBroker(broker);
}
 
开发者ID:apache,项目名称:tomee,代码行数:14,代码来源:OpenEjbBrokerFactoryTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PayloadTermQuery类代码示例发布时间:2022-05-22
下一篇:
Java ImmutableRoaringBitmap类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap