projects
/
demos
/
kafka
/
training
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Verbesserungen an Setup und Vorführ-Srkipt gemerged
[demos/kafka/training]
/
src
/
main
/
java
/
de
/
juplo
/
kafka
/
EndlessConsumer.java
diff --git
a/src/main/java/de/juplo/kafka/EndlessConsumer.java
b/src/main/java/de/juplo/kafka/EndlessConsumer.java
index
0238521
..
58374f4
100644
(file)
--- a/
src/main/java/de/juplo/kafka/EndlessConsumer.java
+++ b/
src/main/java/de/juplo/kafka/EndlessConsumer.java
@@
-42,6
+42,7
@@
public class EndlessConsumer<K, V> implements Runnable
try
{
log.info("{} - Subscribing to topic {}", id, topic);
try
{
log.info("{} - Subscribing to topic {}", id, topic);
+ rebalanceListener.enableCommits();
consumer.subscribe(Arrays.asList(topic), rebalanceListener);
while (true)
consumer.subscribe(Arrays.asList(topic), rebalanceListener);
while (true)
@@
-74,7
+75,6
@@
public class EndlessConsumer<K, V> implements Runnable
catch(WakeupException e)
{
log.info("{} - RIIING! Request to stop consumption - commiting current offsets!", id);
catch(WakeupException e)
{
log.info("{} - RIIING! Request to stop consumption - commiting current offsets!", id);
- consumer.commitSync();
shutdown();
}
catch(RecordDeserializationException e)
shutdown();
}
catch(RecordDeserializationException e)
@@
-88,12
+88,12
@@
public class EndlessConsumer<K, V> implements Runnable
offset,
e.getCause().toString());
offset,
e.getCause().toString());
- consumer.commitSync();
shutdown(e);
}
catch(Exception e)
{
shutdown(e);
}
catch(Exception e)
{
- log.error("{} - Unexpected error: {}", id, e.toString(), e);
+ log.error("{} - Unexpected error: {}, disabling commits", id, e.toString(), e);
+ rebalanceListener.disableCommits();
shutdown(e);
}
finally
shutdown(e);
}
finally