将 flink uid 命名为 operator 的最佳实践

igx*_*igx 2 apache-flink flink-streaming

是否有命名UIDfor 运算符的最佳实践?它可以是简单的东西吗

stream.flatMap(new FlatMapFunc).uid("1")
    .assignTimestampsAndWatermarks(new TimestampExtractor).uid("2")
    .keyBy(r => r.key )
    .timeWindow(Time.minutes(10))
    .allowedLateness(Time.minutes(30))
    .process(new ProcessFunc).uid("3")
Run Code Online (Sandbox Code Playgroud)

或者有一些命名 uid 的规则/建议?

Eze*_*iel 5

UID 没有命名约定,但在我们的团队中,我们使用的值与在 operator.name() 中使用的值相同。name 值用于在 Flink UI 中渲染操作符框

这样我们就有了这样的代码,对我们来说是语义和简单的:

        streamExecutionEnvironment
        .addSource(new KafkaConsumer(kafkaConsumerOptions))
        .name("Kafka topic reader").uid("Kafka topic reader")
        .filter(new CreatedBy("my uncle"))
        .name("Created by my uncle filter").uid("Created by my uncle filter")
        .map(new ToInvoice())
        .name("To invoice mapper").uid("To invoice mapper")
Run Code Online (Sandbox Code Playgroud)