|
Re: Reporting failures via Thrift Client [message #1828952 is a reply to message #1828921] |
Tue, 23 June 2020 03:10  |
Eclipse User |
|
|
|
Hi Jon,
The Thrift client will throw exceptions that happen during specific invocations, but a failed update will not be reflected in the Thrift responses (as it's not a result from those responses).
You can either poll the listInstances Thrift API, and check the latest status message (exceptions are not included), or subscribe to the Artemis topic (but exceptions are not included, either). We'd have to add in the exception handling, but I'm wondering how to handle the risk of revealing too much about the server through an exception. Should we add a flag to the server product to enable the serialisation of exceptions into status updates, or use Shiro somehow so if you authenticate as an admin, you get those exceptions?
If it helps, here are the technical details on how to do the polling/subscribing :-). Here are the docs on listInstances in the Thrift API:
https://www.eclipse.org/hawk/server/api/#hawklistinstances
As for how to subscribe to the Artemis topic maintained by the server for the index in question, you can use the watchStateChanges to set up such a subscription:
https://www.eclipse.org/hawk/server/api/#hawkwatchstatechanges
To do that from Java, you have the connectToArtemis method in the APIUtils class:
https://git.eclipse.org/c/hawk/hawk.git/tree/server/plugins/org.eclipse.hawk.service.api/src/org/eclipse/hawk/service/api/utils/APIUtils.java#n114
For an example on how to write a MessageHandler and how to link it to an Artemis consumer, see here:
https://git.eclipse.org/c/hawk/hawk.git/tree/server/plugins/org.eclipse.hawk.service.remote.thrift/src/org/eclipse/hawk/service/remote/thrift/ThriftRemoteModelIndexer.java#n99
https://git.eclipse.org/c/hawk/hawk.git/tree/server/plugins/org.eclipse.hawk.service.remote.thrift/src/org/eclipse/hawk/service/remote/thrift/ThriftRemoteModelIndexer.java#n636
Kind regards,
Antonio
|
|
|
Powered by
FUDForum. Page generated in 0.07928 seconds