Commit b6d5162e authored by Federico Mestrone's avatar Federico Mestrone
Browse files

Fixed bug - some properties were not read into IngesterMain class

parent 47167485
......@@ -14,11 +14,17 @@ public class IngesterMain {
static String projectId;
static String baseUrl;
static String fileToRead;
static TargetDataStore target;
static IngesterMode mode;
static IngesterStyle style;
public static void setConfig(Properties configProps) {
projectId = configProps.getProperty("gcp.project-id");
baseUrl = "https://" + projectId + ".appspot.com/%s/impression";
fileToRead = configProps.getProperty("ingest.filename");
target = TargetDataStore.valueOf(configProps.getProperty("ingest.target"));
mode = IngesterMode.valueOf(configProps.getProperty("ingest.mode"));
style = IngesterStyle.valueOf(configProps.getProperty("ingest.style"));
}
public static void sendOne(Ingester ingester) {
......@@ -114,9 +120,7 @@ public class IngesterMain {
public static void main(String[] args) throws IOException {
Properties props = new Properties();
props.load(HttpApiMain.class.getResourceAsStream("/gcp.properties"));
TargetDataStore target = TargetDataStore.valueOf(props.getProperty("ingest.target"));
IngesterMode mode = IngesterMode.valueOf(props.getProperty("ingest.mode"));
IngesterStyle style = IngesterStyle.valueOf(props.getProperty("ingest.style"));
setConfig(props);
Ingester ingester = mode.getIngester();
ingester.setTarget(target);
style.getFunction().accept(ingester);
......
gcp.project-id=qwiklabs-gcp-56c3e61809c73e4d
gcp.topic-name=ad-impressions
gcp.bigtable-instance=instance-1
ingest.filename=train.csv
ingest.mode=APP_ENGINE
ingest.target=CLOUD_PUBSUB
ingest.filename=~/test.csv
ingest.mode=DIRECT
ingest.target=CLOUD_DATASTORE
ingest.style=FROM_FILE
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment