This page is meant as a template for writing a KIP. To create a KIP choose Tools->Copy on this page and modify with your content and replace the heading with the next KIP number and a description of your issue. Replace anything in italics with your own description.

Status

Current stateUnder Discussion

Discussion threadhere

JIRA: TBD

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

Motivation

The doc of SourceTask#poll() encourages connector user to return null in order to transition to the PAUSED state when there is no available data. That is a bit weird for scala user since null should be eliminated from code base. We should encourage user to return empty list rather than a null value.

Public Interfaces

No changes to public interface.

Proposed Changes

Doc change is shown below.

* <p>
* Poll this source task for new records. If no data is currently available, this method
* should block but return control to the caller regularly (by returning {@code null} or empty list) in
* order for the task to transition to the {@code PAUSED} state if requested to do so.
* </p>

code change is shown below.

WorkerSourceTask#execute
if (toSend == null || toSend.isEmpty()) { // here 
    log.trace("{} Nothing to send to Kafka. Polling source for additional records", this);
    long start = time.milliseconds();
    toSend = poll();
    if (toSend != null) {
        recordPollReturned(toSend.size(), time.milliseconds() - start);
    }
}
if (toSend == null || toSend.isEmpty()) // here
    continue;

Compatibility, Deprecation, and Migration Plan

None

Rejected Alternatives

  • No labels