Skip to content

Handle consumer exception#121

Open
barbarosalp wants to merge 5 commits intovert-x3:masterfrom
barbarosalp:handle-consumer-exception
Open

Handle consumer exception#121
barbarosalp wants to merge 5 commits intovert-x3:masterfrom
barbarosalp:handle-consumer-exception

Conversation

@barbarosalp
Copy link

  1. Fixes master branch failure because of ExampleTest
  2. Handling the error and fail the handler properly.

import java.util.Map;

@RunWith(VertxUnitRunner.class)
@Ignore("This is an example test class.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this example class test for ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is just a reference about how to implement tests. Because there is no boostrap.servers defined, this causes master branch to fail.

try {
partitionInfos = done.result();
} catch (Exception e) {
handler.handle(Future.failedFuture(e));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add tests?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a test for this. Can you guys have a look?

@barbarosalp barbarosalp force-pushed the handle-consumer-exception branch from 0f8044c to d35cfa2 Compare February 16, 2019 19:47
for (org.apache.kafka.common.PartitionInfo kafkaPartitionInfo: done.result()) {
List<org.apache.kafka.common.PartitionInfo> partitionInfos = done.result();
if (partitionInfos == null){
partitionInfos = new ArrayList<>();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of returning an empty list of partitions, shouldn't we just fail the handler with a proper message saying, the topic does not exist and the auto-create topic is disabled
?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have pushed a new commit. Now, this fails when partitionInfos is null.

@barbarosalp
Copy link
Author

Could you please have a look? @vietj @iranna90 @ppatierno

@FrancescoBorzi
Copy link

@vietj @ppatierno can you please have a look at this?

Copy link
Member

@ppatierno ppatierno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few comments and at same time conflicts to fix.

@@ -0,0 +1,53 @@
package io.vertx.kafka.client.common.impl;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have an Helper class, can you put these methods there please?

import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all these changes are not needed, they are just moved imports. Please revert.

import io.vertx.kafka.client.common.TopicPartition;
import io.vertx.kafka.client.common.impl.CloseHandler;
import io.vertx.kafka.client.common.impl.Helper;
import io.vertx.kafka.client.common.impl.PartitionsForHelper;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto as above

import io.vertx.kafka.client.consumer.KafkaConsumerRecords;
import io.vertx.kafka.client.consumer.KafkaReadStream;
import io.vertx.kafka.client.consumer.OffsetAndMetadata;
import io.vertx.kafka.client.consumer.OffsetAndTimestamp;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto as above

import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.function.Supplier;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't rearrange the imports please, revert this change


import java.io.File;
import java.io.IOException;
import java.util.Properties;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't rearrange the imports order please, revert.

@@ -0,0 +1,68 @@
package io.vertx.kafka.client.tests;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we need a new test class for these tests?

@ppatierno
Copy link
Member

@FrancescoBorzi @barbarosalp I reviewed the PR

@barbarosalp
Copy link
Author

Thanks @ppatierno, I will try to address them soon.

@ppatierno
Copy link
Member

@barbarosalp still interested in it?

@aesteve aesteve mentioned this pull request Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

6 participants