rocketraman
10/16/2019, 7:35 PMCaused by: java.lang.ClassCastException: class org.apache.pulsar.client.impl.BatchMessageIdImpl cannot be cast to class kotlin.Unit (org.apache.pulsar.client.impl.BatchMessageIdImpl and kotlin.Unit are in unnamed module of loader 'app')
at app.SomeConsumer$invoke$1.invokeSuspend(SomeConsumer.kt:40) ~[classes/:?]
... suppressed 5 lines
The line at SomeConsumer:40 is a suspending lambda that invokes a suspend function which returns nothing i.e. Unit. The last line of that suspend function is actually a CompletableFuture.await() suspending call that produces an org.apache.pulsar.client.impl.BatchMessageIdImpl, but the function is defined to return Unit (and even if the last line of the function is changed to Unit this still happens. Weird!