Github user HilmiYildirim commented on a diff in the pull request: https://github.com/apache/flink/pull/706#discussion_r31007499 --- Diff: flink-staging/flink-hbase/src/test/java/org/apache/flink/addons/hbase/example/HBaseWriteStreamExample.java --- @@ -0,0 +1,114 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.addons.hbase.example; + +import java.io.IOException; + +import org.apache.flink.api.common.io.OutputFormat; +import org.apache.flink.configuration.Configuration; +import org.apache.flink.streaming.api.datastream.DataStream; +import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; +import org.apache.flink.streaming.api.functions.source.SourceFunction; +import org.apache.flink.util.Collector; +import org.apache.hadoop.hbase.HBaseConfiguration; +import org.apache.hadoop.hbase.client.HTable; +import org.apache.hadoop.hbase.client.Put; +import org.apache.hadoop.hbase.util.Bytes; + +/** + * + * This is an example how to write streams into HBase. In this example the + * stream will be written into a local Hbase but it is possible to adapt this + * example for an HBase running in a cloud. You need a running local HBase with a + * table "flinkExample" and a column "entry". If your HBase configuration does + * not fit the hbase-site.xml in the resource folder then you gave to delete temporary this + * hbase-site.xml to execute the example properly. + * + */ +public class HBaseWriteStreamExample { + + public static void main(String[] args) { + final StreamExecutionEnvironment env = StreamExecutionEnvironment + .getExecutionEnvironment(); + + // data stream with random numbers + DataStream<String> dataStream = env.addSource(new SourceFunction<String>() { + + @Override + public boolean reachedEnd() throws Exception { + return false; + } + + @Override + public String next() throws Exception { + return String.valueOf(Math.floor(Math.random() * 100)); + } + + }); + dataStream.write(new HBaseOutputFormat(), 0L); + + try { + env.execute(); + } catch (Exception e) { --- End diff -- Great
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---