-
Notifications
You must be signed in to change notification settings - Fork 357
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
New client PreInvocationInterceptor and PostInvocationInterceptor SPI #4301
New client PreInvocationInterceptor and PostInvocationInterceptor SPI #4301
Conversation
New SPI to provide This can be particularly useful for logging, measuring and tracing the requests. The |
… executed around the request Signed-off-by: Jan Supol <jan.supol@oracle.com>
0f9149d
to
f4ccbb3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very nice and rich API beyond what I imagined. I tried some experiments with it, and can be seen on this branch:
pdudits@7ff7e84: implementing thread-local context propagation for async()
and rx()
calls will be straightforward
pdudits@e9397cf: Reimplementing AsyncInterceptor without need for executorService wrapping is also simple. Only missing thing is, that the PreInvocationInterceptor doesn't know the kind of invocation that is happening, and therefore cannot be registered as top-level component, but need to wait until the client is sure, that it will invoke async request.
pdudits@ed56aca: Throwing Error in PostInvocationInterceptor
hides it in suppresed exceptions. It would be better to include first throwable as a cause, as also commented on this PR.
pdudits@63c2cc3: Trying context propagation with third-party RxInvoker (RxJava) fails -- the invoker doesn't invoke the interceptor on calling thread, therefore the ultimate goal of being able to always propagate calling thread context is not met by this PR.
Do you see any way of making this possible? Or is it something that RxInvokerProviders need to support explicitly?
core-client/src/main/java/org/glassfish/jersey/client/InvocationInterceptorStages.java
Outdated
Show resolved
Hide resolved
Maybe some other use case would make sense - to implement something similar to I monitor requests for such an interface anyway, I try to come up with some PR. |
Signed-off-by: Jan Supol <jan.supol@oracle.com>
Signed-off-by: Jan Supol <jan.supol@oracle.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
… executed around the request
Signed-off-by: Jan Supol jan.supol@oracle.com