Skip to content
Open
Show file tree
Hide file tree
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 @@ -290,8 +290,8 @@ public void run() {
}
}
if (!isReplayThread) {
kafkaSourceState.getTopicOffsetMap().get(record.topic()).put(record.partition(),
record.offset());
kafkaSourceState.getTopicOffsetMap().get(record.topic())
.putIfAbsent(record.partition(), record.offset());
}
if (endReplay(record)) {
inactive = true;
Expand All @@ -300,7 +300,7 @@ public void run() {
}
} else {
if (!isReplayThread) {
kafkaSourceState.getTopicOffsetMap().get(record.topic()).put(record.partition(),
kafkaSourceState.getTopicOffsetMap().get(record.topic()).putIfAbsent(record.partition(),
record.offset());
}
if (metrics != null) {
Expand Down Expand Up @@ -351,7 +351,13 @@ public void run() {
void seekToRequiredOffset() {}

boolean isRecordAfterStartOffset(ConsumerRecord record) {
return true;
Map<Integer, Long> partitionMap = kafkaSourceState.getTopicOffsetMap().get(record.topic());
if (partitionMap == null) {
return true;
}

Long offsetThreshold = partitionMap.get(record.partition());
return offsetThreshold == null || record.offset() > offsetThreshold;
}

boolean endReplay(ConsumerRecord record) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ public StateFactory<KafkaSourceState> init(SourceEventListener sourceEventListen
"true"));
topicOffsetMapConfig = optionHolder.validateAndGetStaticValue(TOPIC_OFFSET_MAP, null);
}
partitions = (partitionList != null) ? partitionList.split(KafkaIOUtils.HEADER_SEPARATOR) : null;
partitions = (partitionList != null) ? partitionList.split(KafkaIOUtils.HEADER_SEPARATOR) : new String[]{"0"};
topics = topicList.split(KafkaIOUtils.HEADER_SEPARATOR);
seqEnabled = optionHolder.validateAndGetStaticValue(SEQ_ENABLED, "false").equalsIgnoreCase("true");
optionalConfigs = optionHolder.validateAndGetStaticValue(ADAPTOR_OPTIONAL_CONFIGURATION_PROPERTIES, null);
Expand Down
20 changes: 4 additions & 16 deletions findbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,6 @@
-->

<FindBugsFilter>
<Match>
<Class name="io.siddhi.extension.io.kafka.source.KafkaSource"/>
<Bug pattern="IMPROPER_UNICODE"/>
</Match>
<Match>
<Class name="io.siddhi.extension.io.kafka.source.KafkaReplayResponseSource"/>
<Bug pattern="IMPROPER_UNICODE"/>
</Match>
<Match>
<Class name="io.siddhi.extension.io.kafka.source.KafkaConsumerThread"/>
<Bug pattern="IMPROPER_UNICODE"/>
</Match>
<Match>
<Class name="io.siddhi.extension.io.kafka.sink.KafkaSink"/>
<Bug pattern="IMPROPER_UNICODE"/>
</Match>
<Match>
<Class name="io.siddhi.extension.io.kafka.multidc.source.SourceSynchronizer"/>
<Bug pattern="DLS_DEAD_LOCAL_STORE"/>
Expand All @@ -42,4 +26,8 @@
<Package name="~io\.siddhi\.extension\.io\.kafka.*"/>
<Bug pattern="SIC_INNER_SHOULD_BE_STATIC"/>
</Match>
<Match>
<Class name="io.siddhi.extension.io.kafka.source.KafkaSource"/>
<Bug pattern="RCN_REDUNDANT_COMPARISON_OF_NULL_AND_NONNULL_VALUE"/>
</Match>
</FindBugsFilter>
18 changes: 16 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,26 @@
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
<plugin>
<plugin><!-- Overridden from parent pom to exclude generated sources -->
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<configuration>
<configuration combine.self="override">
<effort>Max</effort>
<threshold>Low</threshold>
<xmlOutput>true</xmlOutput>
<spotbugsXmlOutputDirectory>${project.build.directory}/findbugs</spotbugsXmlOutputDirectory>
<excludeFilterFile>${maven.findbugsplugin.version.exclude}</excludeFilterFile>
<!--Exclude generated sources-->
</configuration>
<executions>
<execution>
<id>analyze-compile</id>
<phase>compile</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>

Expand Down