java - Poll Interval for Kafka Connect SourceTask -
i'm implementing custom source connector using kafka-connect api, can used poll rest-apis , sink json response kafka topic. i'm wondering how realize polling interval sourcetask, how jdbc connector offers one. somewhere have set thread sleep, have this?
i solved use case in sourcetask
implementation adding private field of type long
store time stamp. @ first poll()
invocation field not yet initialized, therefore configured rest-apis polled. while first invocation mentioned long
field get's initialized current time stamp. in following poll()
invocations time stamp of previous invocation get's checked. if amount of elapsed milliseconds since previous poll()
smaller configured interval between 2 polls, send thread sleep since configured milliseconds elapsed.
Comments
Post a Comment