0

I have the following definition of the JDBC source in Apache Flink.

    val jdbcSource = JdbcSource.builder<LoggedInEvent>()
    .setDBUrl("jdbc:postgresql://db:5432/postgres")
    .setSql("SELECT player_id, past_logins FROM user_initial_data")
    .setUsername("postgres")
    .setPassword("example")
    .setTypeInformation(TypeInformation.of(PlayerLoggedInEvent::class.java))
    .setResultExtractor { LoggedInEvent(it.getInt(1).toString(), it.getInt(2), Instant.now().toEpochMilli()) }
    .build()

val snapshotsStream = env.fromSource(jdbcSource, WatermarkStrategy.noWatermarks(), "LoggedInSnapshots")

Currently I'm experiencing two issues with this solution:

  1. I can't schedule this to execute every N seconds, so is there any simple way to do it with existing tooling?
  2. This is realted to #1, but this executes only once and job finishes. I want this to be scheduled and run continuously within the same job.

1 Answer 1

1

Flink does not provide this sort of scheduling, or polling.

On the other hand, Kafka Connect does this support this: https://docs.confluent.io/kafka-connectors/jdbc/current/source-connector/source_config_options.html

Sign up to request clarification or add additional context in comments.

1 Comment

Would it make sense to create my own source with scheduling based on current implementation of JdbcSource?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.