vertx-kafka-client icon indicating copy to clipboard operation
vertx-kafka-client copied to clipboard

BufferSerializer not able to work with "core" Buffer

Open matzew opened this issue 6 years ago • 2 comments

When using the rx-java2 package, the IDE suggests using the reactivex package for various classes, including Buffer. However that's not really working, when using the BufferDeserializer.

io.reactivex.exceptions.OnErrorNotImplementedException: io.vertx.core.buffer.impl.BufferImpl cannot be cast to io.vertx.reactivex.core.buffer.Buffer
	at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:704)
	at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:701)
	at io.reactivex.internal.subscribers.LambdaSubscriber.onError(LambdaSubscriber.java:79)
	at io.reactivex.internal.subscribers.LambdaSubscriber.onNext(LambdaSubscriber.java:69)
	at io.vertx.reactivex.core.impl.FlowableReadStream$1.onNext(FlowableReadStream.java:95)
	at io.reactivex.processors.UnicastProcessor.drainRegular(UnicastProcessor.java:213)
	at io.reactivex.processors.UnicastProcessor.drain(UnicastProcessor.java:289)
	at io.reactivex.processors.UnicastProcessor.onNext(UnicastProcessor.java:349)
	at io.vertx.reactivex.core.impl.FlowableReadStream$1.lambda$onSubscribe$1(FlowableReadStream.java:85)
	at io.vertx.kafka.client.consumer.impl.KafkaConsumerImpl.lambda$handler$1(KafkaConsumerImpl.java:77)
	at io.vertx.kafka.client.consumer.impl.KafkaReadStreamImpl.run(KafkaReadStreamImpl.java:206)
	at io.vertx.kafka.client.consumer.impl.KafkaReadStreamImpl.lambda$schedule$7(KafkaReadStreamImpl.java:167)
	at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:339)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassCastException: io.vertx.core.buffer.impl.BufferImpl cannot be cast to io.vertx.reactivex.core.buffer.Buffer
	at io.streamzi.strombrau.router.kafka.KafkaInputConsumer.lambda$null$0(KafkaInputConsumer.java:51)
	at io.reactivex.internal.subscribers.LambdaSubscriber.onNext(LambdaSubscriber.java:65)
	... 15 more

matzew avatar Jun 15 '18 20:06 matzew

I think using the core one is fine, but it's not 100% clear to me why the CodeGen does generate the other one for reactivex.

Question: should the Deserializer work w/ the reactivex one? or should it be "leveraging" the codegen mechanism ?

matzew avatar Jun 15 '18 20:06 matzew

I believe we need to have a specific serializer for code code buffer wrapper or find another solution

vietj avatar Jun 15 '18 21:06 vietj