Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ public void start(Map<String, String> props) {

@Override
public List<SourceRecord> poll() throws InterruptedException {
if (maxRecords > 0 && count >= maxRecords) {
throw new ConnectException(
String.format("Stopping connector: generated the configured %d number of messages", count)
);
}

if (maxInterval > 0) {
try {
Expand Down Expand Up @@ -189,12 +194,6 @@ public List<SourceRecord> poll() throws InterruptedException {
final org.apache.kafka.connect.data.Schema messageSchema = avroData.toConnectSchema(avroSchema);
final Object messageValue = avroData.toConnectData(avroSchema, randomAvroMessage).value();

if (maxRecords > 0 && count >= maxRecords) {
throw new ConnectException(
String.format("Stopping connector: generated the configured %d number of messages", count)
);
}

final List<SourceRecord> records = new ArrayList<>();
SourceRecord record = new SourceRecord(
SOURCE_PARTITION,
Expand Down