Repository: camel Updated Branches: refs/heads/master 1608f76e7 -> a3f468c27
[CAMEL-9869] Create Apache Flink Component Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4c5b9c03 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4c5b9c03 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4c5b9c03 Branch: refs/heads/master Commit: 4c5b9c032207caca2068007fc1943736f4f68dde Parents: 1608f76 Author: Subhobrata Dey <sbc...@gmail.com> Authored: Thu Apr 28 22:40:04 2016 -0400 Committer: Claus Ibsen <davscl...@apache.org> Committed: Fri Apr 29 11:59:50 2016 +0200 ---------------------------------------------------------------------- components/camel-flink/src/main/docs/flink.adoc | 103 +++++++++++++++++++ 1 file changed, 103 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/4c5b9c03/components/camel-flink/src/main/docs/flink.adoc ---------------------------------------------------------------------- diff --git a/components/camel-flink/src/main/docs/flink.adoc b/components/camel-flink/src/main/docs/flink.adoc new file mode 100644 index 0000000..1660a66 --- /dev/null +++ b/components/camel-flink/src/main/docs/flink.adoc @@ -0,0 +1,103 @@ +[[camel-flink-CamelFlinkComponent]] +Camel Flink Component +~~~~~~~~~~~~~~~~~~~~~ + +*Available as of Camel 2.18* + +This documentation page covers the https://flink.apache.org[Apache Flink] +component for the Apache Camel. The *camel-flink* component provides a +bridge between Camel connectors and Flink tasks. + +This Camel Flink connector provides a way to route message from various +transports, dynamically choosing a flink task to execute, use incoming +message as input data for the task and finally deliver the results back to +the Camel pipeline. + +Maven users will need to add the following dependency to +their `pom.xml` for this component: + +[source,xml] +------------------------------------------------------------ +<dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-flink</artifactId> + <version>x.x.x</version> + <!-- use the same version as your Camel core version --> +</dependency> +------------------------------------------------------------ + +[[camel-flink-URIFormat]] +URI Format +^^^^^^^^^^ + +Currently, the Flink Component supports only Producers. One can create DataSet, DataStream jobs. + +[source,java] +------------------------------------------------- +flink:dataset?dataset=#myDataSet&dataSetCallback=#dataSetCallback +flink:datastream?datastream=#myDataStream&dataStreamCallback=#dataStreamCallback +------------------------------------------------- + +Flink DataSet Callback +^^^^^^^^^^^^^^^^^^^^^^ + +[source,java] +----------------------------------- +@Bean +public DataSetCallback<Long> dataSetCallback() { + return new DataSetCallback<Long>() { + public Long onDataSet(DataSet dataSet, Object... objects) { + try { + dataSet.print(); + return new Long(0); + } catch (Exception e) { + return new Long(-1); + } + } + }; +} +----------------------------------- + +Flink DataStream Callback +^^^^^^^^^^^^^^^^^^^^^^^^^ + +[source,java] +--------------------------- +@Bean +public VoidDataStreamCallback dataStreamCallback() { + return new VoidDataStreamCallback() { + @Override + public void doOnDataStream(DataStream dataStream, Object... objects) throws Exception { + dataStream.flatMap(new Splitter()).print(); + + environment.execute("data stream test"); + } + }; +} +--------------------------- + +Camel-Flink Producer call +^^^^^^^^^^^^^^^^^^^^^^^^^ + +[source,java] +----------------------------------- +CamelContext camelContext = new SpringCamelContext(context); + +String pattern = "foo"; + +try { + ProducerTemplate template = camelContext.createProducerTemplate(); + camelContext.start(); + Long count = template.requestBody("flink:dataSet?dataSet=#myDataSet&dataSetCallback=#countLinesContaining", pattern, Long.class); + } finally { + camelContext.stop(); + } +----------------------------------- + +See Also +^^^^^^^^ + +* link:configuring-camel.html[Configuring Camel] +* link:component.html[Component] +* link:endpoint.html[Endpoint] +* link:getting-started.html[Getting Started] +