-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Improve error message for Reactive Messaging coroutine support #25654
Conversation
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.
See comment
@@ -13,7 +13,7 @@ abstract class AbstractSubscribingCoroutineInvoker(private val beanInstance: Any | |||
override fun invoke(vararg args: Any?): CompletableFuture<Any?> { | |||
val coroutineScope = Arc.container().instance(ApplicationCoroutineScope::class.java).get() | |||
val dispatcher: CoroutineDispatcher = Vertx.currentContext()?.let(::VertxDispatcher) | |||
?: throw IllegalStateException("No Vertx context found") | |||
?: throw IllegalStateException("No Vertx context found. Consider using @NonBlocking on the suspend method.") |
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.
This change needs to be on io.quarkus.scheduler.kotlin.runtime.AbstractCoroutineInvoker
For reactive messaging, this is an edge case, I propose No Vertx context found. Consider emitting items on Vert.x context.
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.
Ah, you are right, wrong 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.
Actually... the error is coming from AbstractSubscribingCoroutineInvoker
, not io.quarkus.scheduler.kotlin.runtime.AbstractCoroutineInvoker
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.
In any case, error message updated.
FWIW, this error should never happen for the scheduler, as suspend
methods are always executed on a vert.x thread
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.
Oh, ok I'd missed that. That's because there is an emitter used inside, which itself ends up calling an incoming method with suspend
... But @NonBlocking
won't solve anything on the case with Mutiny tick.
Shall we write something generic along :
"Consider using @NonBlocking
on the caller method, or make sure the upstream emits items on the Vert.x context".
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.
👍🏼 , done
Relates to: #25502