Regarding the second part.
Kotlin already provides adapter for suspending on CompletableFuture
, so you can just do:
suspend fun ack(...) = rabbitChannel.asyncCompletableRpc(...).await()
I guess this is because asyncCompletableRpc()
may throw IOException
, so IntelliJ assumed it is blocking. Its name and docs clearly say it is asynchronous, so Dispatchers.IO
, should not be needed.
But… I must say docs of RabbitMQ are confusing to me here. It says: “Asynchronously send a method over this channel.” and that it throws IOException
if there is “Problem transmitting method.”. This is ridiculous, it can’t be both. I would assume it performs only some non-blocking check initially (which may result in IOException
) and then it performs sending asynchronously. In this case Dispatchers.IO
is not needed, but it is really unclear to me ¯\_(ツ)_/¯
edit: Or it sends the data synchronously, by blocking and then only receives ack asynchronously. Then it would probably require Dispatchers.IO
. But this is contrary to what docs say.
I’m not sure what do you mean here. What is the problem?