Hello, I want to know what is the right interface ...
# troubleshooting
f
Hello, I want to know what is the right interface api to implement custom sources and sinks, I find in the documentation deprecated classes like SinkFunction, RichSinkFunction, SourceFunction, etc. for Sources is correct latest way to implement? https://nightlies.apache.org/flink/flink-docs-stable/api/java/org/apache/flink/api/connector/source/Source.html and in case of sinks is it correct? https://nightlies.apache.org/flink/flink-docs-stable/api/java/org/apache/flink/api/connector/sink2/Sink.html But when the AsyncBase should be used for sinks?
a
Hi, You are correct, for sources you should implement
Source
interface. For sinks you have 2 options, either sink interface you've specified, or AsyncSink AsyncSinkBase can be used if your destination has asynchronous client, it abstracts away common functionality.
πŸ™Œ 1
f
Hello, thanks for the answer, do you know some samples or tutorials to understand these internals better? my goal is to implement a custom source and sink with e2e exactly-once or at-least-once capabilities without using something deprecated πŸ˜„
a
For samples you can check out existing connectors. Examples are: MongoDB (source + at-least-once sink) Kafka examples of AsyncSink implementation can be found in: AWS connectors, e.g. SQS sink Prometheus sink
πŸ‘ 1
f
thx