[ 
https://issues.apache.org/jira/browse/BAHIR-85?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16349858#comment-16349858
 ] 

shukun.lee edited comment on BAHIR-85 at 2/2/18 6:31 AM:
---------------------------------------------------------

[~atharvai] [~rmetzger]

I think the reasonable way to support is add a function variable in RedisSink 
like
{code:java}
private Function<IN, String> updateFuc;
{code}
And provide set method like
{code:java}
public RedisSink<IN> setUpdateFuc(Function<IN, String> fuc) {
    updateFuc = fuc;
    return this;
}
{code}
there are some advantages below:

1、Backward compatibility,No need change 'RedisMapper' interface

2、comfortable style when use like
{code:java}
new RedisSink[(String, ItemsSketch[String])](conf, new XXRedisMapper)
    .setUpdateFuc(v->{...}){code}


was (Author: desugun):
I think the reasonable way to support is add a function variable in RedisSink 
like
{code:java}
private Function<IN, String> updateFuc;
{code}
And provide set method like
{code:java}
public RedisSink<IN> setUpdateFuc(Function<IN, String> fuc) {
    updateFuc = fuc;
    return this;
}
{code}
there are some advantages below:

1、Backward compatibility,No need change 'RedisMapper' interface

2、comfortable style when use like
{code:java}
new RedisSink[(String, ItemsSketch[String])](conf, new XXRedisMapper)
    .setUpdateFuc(v->{...}){code}

> Redis Sink Connector should allow update of command without reinstatiation 
> ---------------------------------------------------------------------------
>
>                 Key: BAHIR-85
>                 URL: https://issues.apache.org/jira/browse/BAHIR-85
>             Project: Bahir
>          Issue Type: Improvement
>          Components: Flink Streaming Connectors
>            Reporter: Atharva Inamdar
>            Priority: Major
>
> ref: FLINK-5478
> `getCommandDescription()` gets called when RedisSink is instantiated. This 
> happens only once and thus doesn't allow the command to be updated during run 
> time.
> Use Case:
> As a dev I want to store some data by day. So each key will have some date 
> specified. this will change over course of time. for example: 
> `counts_for_1484265600000` for 2017-01-13. This is not limited to any 
> particular command.
> connector: 
> https://github.com/apache/bahir-flink/blob/master/flink-connector-redis/src/main/java/org/apache/flink/streaming/connectors/redis/RedisSink.java#L114
> I wish `getCommandDescription()` could be called in `invoke()` so that the 
> key can be updated without having to restart.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to