Reputation: 25
Is it possible to invoke Java RMI asynchronously? I'd like my RMI call to return immediately and for the server to invoke a callback once a task is completed.
I'd currently using RMI support from Spring framework, and i couldn't find any documentation describing it in spring, I suspect I'll need to implement it myself. Please provide examples if possible.
Thanks in advance!
Upvotes: 0
Views: 2535
Reputation: 43
I didn't look Spring batch and Spring Integration but without changing the RMI protocol the only way to implement asynchronous call is to span a new thread that wait for the result from the server and this is not a true asynchronous call.
The way to have true asynchronous call is to:
There is only one implementation of such async RMI (I am not sure it is production ready yet).
Here is a good explanation with sequence diagram
Upvotes: 2
Reputation: 308938
RMI is synchronous and doesn't support callbacks as far as I know.
JMS is the Java EE way to make asynch calls. If you're using Spring, it would be a message-driven POJO.
Another place to look, since you're already using Spring, is either Spring Batch or Spring Integration. I'd try either of those before I wrote it myself.
But if that doesn't do it for you, your suspicion is correct - you'll have to implement it yourself.
Upvotes: 2