本文整理匯總了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();
}