keith-turner commented on issue #1018: Scan command now can produce results as 
csv and json. Related to #984
URL: https://github.com/apache/fluo/pull/1018#issuecomment-372339772
 
 
   > @keith-turner what do you think we have a kind of interface on API module? 
Something like this:
   https://gist.github.com/alanblueshift/85437466d7ecf5a001e9a991532275c7
   
   I really like this idea.  Maybe this could be done without adding anything 
to Fluo's API by using the Java 8 consumer and injection via Guice.  For 
example assume someone implemented the following.  
   
   ```java
   package com.foo;
   
   class FluoAvro implements Consumer<CellScanner>, Closeable {  
   //Closeable could be optionally implemented, if implemented scanner would 
close the consumer
   
      @Inject
       FluoAvroScanner(SimpleConfiguration config) {
          ///unsure if should pass Map<String, String> or SimpleConfiguration
       }
     
       void accept(CellScanner scanner) {}
       void close();
   }
   ``` 
   Could possibly do injection in the following way.  Injection needs to work 
with service discovery and instantiation. I am not sure what the best way to do 
the injection is.
   
   ```java
   package com.foo;
   
   class FluoAvro implements Consumer<CellScanner>, Closeable {
      @Inject
       private SimpleConfiguration config;
       void accept(CellScanner scanner) {}
       void close();
   }
   ```
   On the command line could call the consumer as follows.  Having a short name 
for the consumer would be awesome, didn't realize that could be done with SPI.
   
   ```bash
   fluo scan -a myapp --consumer avro \
       -o "avro.schema.url=hdfs://user/xxx/schemas/file.avsc" \
       -o "avro.output.codec=snappy"
   ```
   
   Instead of using `-o` could have `-co` for consumer options.
   
   ```bash
   fluo scan -a myapp --consumer avro \
       -co "avro.schema.url=hdfs://user/xxx/schemas/file.avsc" \
       -co "avro.output.codec=snappy"
   ```
   
   Either way the options would be injected.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to