-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle consumer exception #121
base: master
Are you sure you want to change the base?
Conversation
barbarosalp
commented
Feb 14, 2019
- Fixes master branch failure because of ExampleTest
- Handling the error and fail the handler properly.
@@ -20,6 +21,7 @@ | |||
import java.util.Map; | |||
|
|||
@RunWith(VertxUnitRunner.class) | |||
@Ignore("This is an example test class.") |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
There was a problem hiding this comment.
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?
0f8044c
to
d35cfa2
Compare
for (org.apache.kafka.common.PartitionInfo kafkaPartitionInfo: done.result()) { | ||
List<org.apache.kafka.common.PartitionInfo> partitionInfos = done.result(); | ||
if (partitionInfos == null){ | ||
partitionInfos = new ArrayList<>(); |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
…o false for non-existing topic.
…andle-consumer-exception
Could you please have a look? @vietj @iranna90 @ppatierno |
@vietj @ppatierno can you please have a look at this? |
There was a problem hiding this 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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.PartitionInfo; | ||
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; |
There was a problem hiding this comment.
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.KafkaConsumer; | ||
import io.vertx.kafka.client.consumer.KafkaConsumerRecord; | ||
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
@@ -16,16 +16,17 @@ | |||
|
|||
package io.vertx.kafka.client.tests; | |||
|
|||
import java.io.File; | |||
import java.io.IOException; | |||
import java.util.Properties; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
@FrancescoBorzi @barbarosalp I reviewed the PR |
Thanks @ppatierno, I will try to address them soon. |
@barbarosalp still interested in it? |