类 RedisSinkFunction<IN>
- java.lang.Object
-
- org.apache.flink.api.common.functions.AbstractRichFunction
-
- org.apache.flink.streaming.api.functions.sink.RichSinkFunction<IN>
-
- org.apache.flink.streaming.connectors.redis.table.RedisSinkFunction<IN>
-
- 类型参数:
IN-
- 所有已实现的接口:
Serializable,org.apache.flink.api.common.functions.Function,org.apache.flink.api.common.functions.RichFunction,org.apache.flink.streaming.api.functions.sink.SinkFunction<IN>
- 直接已知子类:
RedisLimitedSinkFunction
public class RedisSinkFunction<IN> extends org.apache.flink.streaming.api.functions.sink.RichSinkFunction<IN>- 另请参阅:
- 序列化表格
-
-
字段概要
字段 修饰符和类型 字段 说明 protected intexpireTimeSecondsprotected Integerttl
-
构造器概要
构造器 构造器 说明 RedisSinkFunction(FlinkConfigBase flinkConfigBase, RedisSinkMapper<IN> redisSinkMapper, org.apache.flink.table.catalog.ResolvedSchema resolvedSchema, org.apache.flink.configuration.ReadableConfig readableConfig)Creates a newRedisSinkFunctionthat connects to the Redis server.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidclose()Closes commands container.voidinvoke(IN input, org.apache.flink.streaming.api.functions.sink.SinkFunction.Context context)Called when new data arrives to the sink, and forwards it to Redis channel.voidopen(org.apache.flink.configuration.Configuration parameters)Initializes the connection to Redis by either cluster or sentinels or single server.-
从类继承的方法 org.apache.flink.api.common.functions.AbstractRichFunction
getIterationRuntimeContext, getRuntimeContext, setRuntimeContext
-
-
-
-
字段详细资料
-
ttl
protected Integer ttl
-
expireTimeSeconds
protected int expireTimeSeconds
-
-
构造器详细资料
-
RedisSinkFunction
public RedisSinkFunction(FlinkConfigBase flinkConfigBase, RedisSinkMapper<IN> redisSinkMapper, org.apache.flink.table.catalog.ResolvedSchema resolvedSchema, org.apache.flink.configuration.ReadableConfig readableConfig)
Creates a newRedisSinkFunctionthat connects to the Redis server.- 参数:
flinkConfigBase- The configuration ofFlinkConfigBaseredisSinkMapper- This is used to generate Redis command and key value from incoming elements.
-
-
方法详细资料
-
invoke
public void invoke(IN input, org.apache.flink.streaming.api.functions.sink.SinkFunction.Context context) throws Exception
Called when new data arrives to the sink, and forwards it to Redis channel. Depending on the specified Redis data type (seeRedisDataType), a different Redis command will be applied. Available commands are RPUSH, LPUSH, SADD, PUBLISH, SET, SETEX, PFADD, HSET, ZADD.- 参数:
input- The incoming data- 抛出:
Exception
-
open
public void open(org.apache.flink.configuration.Configuration parameters) throws ExceptionInitializes the connection to Redis by either cluster or sentinels or single server.- 指定者:
open在接口中org.apache.flink.api.common.functions.RichFunction- 覆盖:
open在类中org.apache.flink.api.common.functions.AbstractRichFunction- 抛出:
IllegalArgumentException- if PoolConfig, ClusterConfig and SentinelConfig are all nullException
-
close
public void close() throws IOExceptionCloses commands container.- 指定者:
close在接口中org.apache.flink.api.common.functions.RichFunction- 覆盖:
close在类中org.apache.flink.api.common.functions.AbstractRichFunction- 抛出:
IOException- if command container is unable to close.
-
-