vert-x3 / vertx-kafka-client

Reactive Kafka Client for Vert.x
Apache License 2.0
84 stars 82 forks source link

Using an EmbeddedServer for testing purposes #63

Closed aesteve closed 7 years ago

aesteve commented 7 years ago

Based on : https://gist.github.com/fjavieralba/7930018

This would be a very nice addition to the stack, having a way to startup a Zk server and a Kafka broker in tests.

The problem is that the gist is using a blocking implementation. If we could create a non-blocking embedded server, future compliant (i.e. notifying "that's OK, both zk and kafka are up, you can start testing", that'd be awesome).

Not an emergency obviously, but a nice addition imo :)

vietj commented 7 years ago

@aesteve we already do that using Debezium kafka cluster that is very convenient to use. You can look at the tests or in the kafka examples https://github.com/vert-x3/vertx-examples/blob/master/kafka-examples/src/main/java/io/vertx/example/kafka/dashboard/MainVerticle.java#L33

aesteve commented 7 years ago

Oh I missed that part.

Works like a charm, thank you !

vietj commented 7 years ago

maybe a candidate for the cookbook ? WDYT ?

aesteve commented 7 years ago

That could be a good candidate indeed (even though it's already present in the examples ?) but unfortunately, it's buggy...

The method withKafkaConfiguration does not work at all.

I think the guys from debezium put the method here but didn't use/test it at all.

The problem is them using new Properties(kafkaProperties), which copies the passed properties as defaults, and then adds their own properties. Using this mechanism makes sense.

But Kafka doesn't use a Properties object but a Map and then iterates over the map keys. And when it does so, it completely ignores the defaults.

Hence you can put whatever property you want in withKafkaConfiguration it won't work.

Not sure why they added this method they don't even seem to use, but that is bugged :\

vietj commented 7 years ago

perhaps you can report it on their JIRA tracker

aesteve commented 7 years ago

https://issues.jboss.org/browse/DBZ-323?_sscc=t

The issue seems easy to fix, but not that easy to test. If you have an opinion, please comment ;)

Thanks anyway Julien.

vietj commented 7 years ago

I would say just contribute a fix at least :-)