當前位置: 首頁>>代碼示例>>Java>>正文


Java BrokerService.setTmpDataDirectory方法代碼示例

本文整理匯總了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();
    }
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:24,代碼來源:JmsBroker.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();              
    } catch (Exception e) {
        exception = e;
        e.printStackTrace();
    }
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:23,代碼來源:JmsBroker.java

示例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();
}
 
開發者ID:streamsets,項目名稱:datacollector,代碼行數:41,代碼來源:TestJmsSource.java

示例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();
}
 
開發者ID:streamsets,項目名稱:datacollector,代碼行數:37,代碼來源:TestJmsTarget.java

示例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);
}
 
開發者ID:moueimei,項目名稱:flume-release-1.7.0,代碼行數:42,代碼來源:TestIntegrationActiveMQ.java


注:本文中的org.apache.activemq.broker.BrokerService.setTmpDataDirectory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。