Skip to content

Commit

Permalink
removed infinity loop #9
Browse files Browse the repository at this point in the history
  • Loading branch information
Kasean committed Dec 29, 2023
1 parent d304ab9 commit 4567f0e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public MessageConsumer(String bootstrapServers, String groupId) {
public void consume(String topic) {
consumer.subscribe(Collections.singletonList(topic));

while (true) {
ConsumerRecords<String, byte[]> records = consumer.poll(Duration.ofMillis(100));
ConsumerRecords<String, byte[]> records = consumer.poll(Duration.ofMillis(1000));
if (!records.isEmpty()) {
for (ConsumerRecord<String, byte[]> record : records) {
System.out.println("Consumed message: " + new String(record.value()));
}
Expand Down

0 comments on commit 4567f0e

Please sign in to comment.