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
Jolokia Java Client - ReadRequest optional #173
Comments
I think it can be easily added client-wise for bulk requests. The plain JSON response already contains all responses, with 404 errors for MBeans which where not found. So all what have to be done is to filter or transform the list accordingly. To make it more flexible, I consider an addition to the API public <R extends J4pResponse<T>,T extends J4pRequest> List<R>
execute(List<T> pRequests,J4pResponseExtractor pExtractor) where What do you think ? |
+1 sounds good. This gives much flexibility with the extractor. |
Just implemented that thinggy. It can be used in two ways:
A sample usage looks like: J4pClient j4p = J4pClient.url("...")
.responseExtractor(ValidatingResponseExtractor.OPTIONAL)
.build(); A missing MBean now simply leaves a You can try the code from branch |
Merged to master. |
Hi
Jolokia version used: 1.2.3
I coud not find in the reference manual or java doc whether the java client supports optional reads. And by that I mean, a ReadRequest where the mbean may not exists. And if the mbean does not exists I just want a response back with an indicator that the mbean didnt exists.
Today I had to add a try .. catch hack, or I would need to do a list call first to see if the mbean is there, and then etc. But I would love if there was a read optional. Then I can use that as well in a List call so I can do a bulk operation.
For an example see the source code of Apache Camel where we have a jolokia command module
I have these 3 mbeans I need to get information from
https://github.com/apache/camel/blob/master/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/DefaultJolokiaCamelController.java#L117
And then this 4th mbean is optional, so I need to do a separate call to handle if it does not exists
https://github.com/apache/camel/blob/master/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/DefaultJolokiaCamelController.java#L148
The text was updated successfully, but these errors were encountered: