-
Notifications
You must be signed in to change notification settings - Fork 165
Add asynchronous MessageHandler interface #934
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
Comments
I'm happy to discuss this with the clients development teams, but you can certainly accomplish this yourself, by having your synchronous message handler distribute the messages asynchronously. |
Vertx for nats may help : https://github.com/nats-io/nats-java-vertx-client |
It won't. That vertx client is a wrapper around the existing client. It's on the roadmap to replace the connection layer in the current client with actual vertx |
As long as I can use the Java client from Kotlin with Is it on the roadmap to support Java fibers/virtual threads/Project Loom? |
"current client" means Java client or Vert.x client? Would be super exciting if the Java client would use Vert.x, and would love to contribute to it if that was to be considered. |
1. Virtual Threads are supported in Options for the dispatcher / internal tasks. For instance:
We've also really cleanup up interrupt handling throughout the entire client. 2. You could make an async message handler. Take a look at
In this mode, every single message is dispatched via a task, using whatever executor is provided (1), instead of a direct call. Theoretically I suppose it's possible to get a message out of order, but I've only made this available, not really tested or used it. 3. The Vertx client wrapper is in use by a customer with much success. It has a custom dispatcher and uses the vertx event loop, there was a whole change to the client to support providing the dispatcher. KV is also currently supported. 4. There is no timeline for vertx support directly in the client. We are definitely considering it. |
Feature Request
The current
MessageHandler
interface has a synchronous method. Please provide an asynchronous version of the same interface.Use Case:
Not sure, but hoping that providing this would allow more messages to be handled at a given time.
Proposed Change:
along with concomitant changes, like adding a method to
Connection
likeAsyncDispatcher createAsyncDispatcher(AsyncMessageHandler handler)
.Who Benefits From The Change(s)?
Those writing
MessageHandler
s that invoke asynchronous methods, specifically, Kotlinsuspend
functions, as well as future use by Java fibers (Project Loom).Alternative Approaches
?
The text was updated successfully, but these errors were encountered: