You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by 碳酸君 <zw...@gmail.com> on 2023/09/22 02:00:28 UTC

Is there any example that use hbase connector in stream API

hi community:

     I'm trying to write some data to hbase in a stream job ,with
flink-connector-hbase-2.2 .
     I have no idea about instantiate
org.apache.flink.connector.hbase.util.HBaseTableSchema and
org.apache.flink.connector.hbase.sink.HBaseMutationConverter .


Regards,
Teii

Re: Is there any example that use hbase connector in stream API

Posted by Hang Ruan <ru...@gmail.com>.
Hi,

There is not a HBase connector  for the DataStream API. But we could follow
codes in the Table API to learn how to use it.

1. We could know how to build a HBaseTableSchema in
HBase2DynamicTableFactory[1].
2. We could know how to build a RowDataToMutationConverter in
HBaseDynamicTableSink[2]. If you need a different converter, you have to
implement your own converter class.

Best,
Hang

[1]
https://github.com/apache/flink-connector-hbase/blob/main/flink-connector-hbase-2.2/src/main/java/org/apache/flink/connector/hbase2/HBase2DynamicTableFactory.java
[2]
https://github.com/apache/flink-connector-hbase/blob/main/flink-connector-hbase-2.2/src/main/java/org/apache/flink/connector/hbase2/sink/HBaseDynamicTableSink.java

碳酸君 <zw...@gmail.com> 于2023年9月22日周五 13:06写道:

> hi community:
>
>      I'm trying to write some data to hbase in a stream job ,with
> flink-connector-hbase-2.2 .
>      I have no idea about instantiate
> org.apache.flink.connector.hbase.util.HBaseTableSchema and
> org.apache.flink.connector.hbase.sink.HBaseMutationConverter .
>
>
> Regards,
> Teii
>

Re: Is there any example that use hbase connector in stream API

Posted by 碳酸君 <zw...@gmail.com>.
HI Антон,Hang

Thanks Reply

I implemented the RichSinkFunction with HbaseClient ,it works well.
I plan to copy some code from
org.apache.flink.connector.hbase.sink.HBaseSinkFunction mainly the
scheduled batch submit ,but except the converter part .

I think I can read from TableAPI and write with RichSinkFunction.

Is that a routine operation in flink ? mix TableAPI and StreamAPI

On Tue, Sep 26, 2023 at 9:25 PM Антон <an...@yandex.ru> wrote:
>
> Hi,
>
> I wrote to hbase using map extending RichMapFunction. I initialized the connection in overrided open method and wrote to hbase in overrided map method.
>
> 22.09.2023, 05:01, "碳酸君" <zw...@gmail.com>:
>
> hi community:
>
>      I'm trying to write some data to hbase in a stream job ,with
> flink-connector-hbase-2.2 .
>      I have no idea about instantiate
> org.apache.flink.connector.hbase.util.HBaseTableSchema and
> org.apache.flink.connector.hbase.sink.HBaseMutationConverter .
>
>
> Regards,
> Teii

Re: Is there any example that use hbase connector in stream API

Posted by Антон <an...@yandex.ru>.
Hi,

I wrote to hbase using map extending RichMapFunction. I initialized the
connection in overrided open method and wrote to hbase in overrided map
method.

22.09.2023, 05:01, "碳酸君" <zw...@gmail.com>:

> hi community:  
>  
>  I'm trying to write some data to hbase in a stream job ,with  
> flink-connector-hbase-2.2 .  
>  I have no idea about instantiate  
> org.apache.flink.connector.hbase.util.HBaseTableSchema and  
> org.apache.flink.connector.hbase.sink.HBaseMutationConverter .  
>  
>  
> Regards,  
> Teii