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


Java StormLocalCluster類代碼示例

本文整理匯總了Java中com.github.sakserv.minicluster.impl.StormLocalCluster的典型用法代碼示例。如果您正苦於以下問題:Java StormLocalCluster類的具體用法?Java StormLocalCluster怎麽用?Java StormLocalCluster使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


StormLocalCluster類屬於com.github.sakserv.minicluster.impl包,在下文中一共展示了StormLocalCluster類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setUp

import com.github.sakserv.minicluster.impl.StormLocalCluster; //導入依賴的package包/類
@Before
public void setUp() throws Exception {
    // Parse the properties file
    propertyParser = new PropertyParser();
    propertyParser.parsePropsFile(PROP_FILE);
    
    // Start Zookeeper
    zookeeperLocalCluster = new ZookeeperLocalCluster.Builder()
            .setPort(Integer.parseInt(propertyParser.getProperty(ConfigVars.ZOOKEEPER_PORT_KEY)))
            .setTempDir(propertyParser.getProperty(ConfigVars.ZOOKEEPER_TEMP_DIR_KEY))
            .setZookeeperConnectionString(propertyParser.getProperty(ConfigVars.ZOOKEEPER_CONNECTION_STRING_KEY))
            .build();
    zookeeperLocalCluster.start();

    // Start Kafka
    kafkaLocalBroker = new KafkaLocalBroker.Builder()
            .setKafkaHostname(propertyParser.getProperty(ConfigVars.KAFKA_HOSTNAME_KEY))
            .setKafkaPort(Integer.parseInt(propertyParser.getProperty(ConfigVars.KAFKA_PORT_KEY)))
            .setKafkaBrokerId(Integer.parseInt(propertyParser.getProperty(ConfigVars.KAFKA_TEST_BROKER_ID_KEY)))
            .setKafkaProperties(new Properties())
            .setKafkaTempDir(propertyParser.getProperty(ConfigVars.KAFKA_TEST_TEMP_DIR_KEY))
            .setZookeeperConnectionString(propertyParser.getProperty(ConfigVars.ZOOKEEPER_CONNECTION_STRING_KEY))
            .build();
    kafkaLocalBroker.start();
    
    // Start MongoDB
    mongodbLocalServer = new MongodbLocalServer.Builder()
            .setIp(propertyParser.getProperty(ConfigVars.MONGO_IP_KEY))
            .setPort(Integer.parseInt(propertyParser.getProperty(ConfigVars.MONGO_PORT_KEY)))
            .build();
    mongodbLocalServer.start();

    // Start Storm
    stormLocalCluster = new StormLocalCluster.Builder()
            .setZookeeperHost(propertyParser.getProperty(ConfigVars.ZOOKEEPER_HOSTNAME_KEY))
            .setZookeeperPort(Long.parseLong(propertyParser.getProperty(ConfigVars.ZOOKEEPER_PORT_KEY)))
            .setEnableDebug(Boolean.parseBoolean(propertyParser.getProperty(ConfigVars.STORM_ENABLE_DEBUG_KEY)))
            .setNumWorkers(Integer.parseInt(propertyParser.getProperty(ConfigVars.STORM_NUM_WORKERS_KEY)))
            .setStormConfig(new Config())
            .build();
    stormLocalCluster.start();
}
 
開發者ID:sakserv,項目名稱:storm-topology-examples,代碼行數:43,代碼來源:KafkaMongodbTopologyTest.java


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