Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Hawk » Reporting failures via Thrift Client
Reporting failures via Thrift Client [message #1828921] Mon, 22 June 2020 12:20 Go to next message
Jonathan Co is currently offline Jonathan CoFriend
Messages: 4
Registered: April 2018
Junior Member
Hi,

Is there a way from the Thrift Client to report errors that have occurred in the indexer? i.e. the indexer failed to update due to X exception?

Thanks
Re: Reporting failures via Thrift Client [message #1828952 is a reply to message #1828921] Tue, 23 June 2020 07:10 Go to previous message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 597
Registered: January 2010
Location: Birmingham, UK
Senior Member

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
Previous Topic:Hawk 2.0 Release
Next Topic:Indexing model changes
Goto Forum:
  


Current Time: Fri May 24 20:29:38 GMT 2024

Powered by FUDForum. Page generated in 0.03010 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top