Add sample to create the client via dynamic proxy
Description
Add a sample on how to create the OpenSearchClient through DynamicProxy. This allows users to add custom logic around the client operations for cross-cutting concerns such as added logging, exception handling, or introducing delays and failures for testing purposes.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.
Hey @HEskandari, I believe this example does not belong here. Any kind of proxying / class rewrite / instrumentation ... is not the concern of OpenSearch Java Client but the framework or application that uses these techniques (hopefully, for reasons). In this regard, the OpenSearch Java Client APIs are no different than any other APIs out there.
@reta does it hurt to have it here? should it just be a SO or maybe someone's blog post? I'd be happy to have it on mine ;)
@reta does it hurt to have it here? should it just be a SO or maybe someone's blog post? I'd be happy to have it on mine ;)
Sure @dblock , but do you really want that? There are few things to keep in mind: JDK releases easily break that (cglib has not been updated for the last 2 years, 3.3.0 was out in 2019). This is very shaky ground for the library whose business is not that ...
Yeah, I think I agree :(
Moved the example here for whoever is interested. Closing.
Thanks for contributing the sample @HEskandari !