hadoop - Copying a file to HDFS2 via camel doesn't work -
does have example of writing files hdfs2 via camel?
i tried following code :
import org.apache.camel.camelcontext; import org.apache.camel.producertemplate; import org.apache.camel.builder.routebuilder; import org.apache.camel.impl.defaultcamelcontext; public final class main { private main() { } public static void main(string args[]) throws exception { camelcontext context = new defaultcamelcontext(); context.addroutes(new routebuilder() { public void configure() { from("file:c:\\files\\src\\2015-03-31_16-58-56.png?noop=true") .to("hdfs2://xxxx:9000/testcamel/d2/qwe.png"); //.to("file:c:\\files\\out"); } }); //producertemplate template = context.createproducertemplate(); context.start(); context.stop(); } }
the files created in hdfs of them empty (0 bytes).
make sure noop=false when consume file hdfs. hdfs component uses chunk consume, if noop true, camel think consumed it.
Comments
Post a Comment