While I was hacking a quick CSV to Firebase upload I did just that instead of writing a custom sink. This is an over simplification of the code:
public static void main(String[] args) throws Exception {
Options options = PipelineOptionsFactory.as(Options.class);
Pipeline p = Pipeline.create(options);
PCollection<String> CsvData = p.apply(TextIO.Read.from("/my_file.csv"));
CsvData.apply(ParDo.named("Firebase").of(new DoFn<String, Void>() {
@Override
public void processElement(ProcessContext c) {
Firebase fb = new Firebase("https://MYAPP.firebaseio.com/");
fb.child("someId").setValue(c.element.getValue());
}
});
}
It works. Is this where a REST API should be consumed on Cloud Dataflow?