-
Bug
-
Resolution: Done
-
Blocker
-
7.1.0.DR19
In EJB development guide, chapter 7.5. Use a Client Interceptor in an Application, the section Insert the Interceptor Programmatically is outdated - this API is no longer available in EJB client for EAP 7.1 (in 7.0 it works).
The developer now needs to do something like this this:
EJBClientContext ctxWithInterceptors = EJBClientContext.getCurrent().withAddedInterceptors(clientInterceptor);
To create an EJBClientContext with the interceptor registered. Then there are basically two options.
First option is to run some code with this EJBClientContext applied using a Callable - EJB calls performed within the Callable will apply the client-side interceptors:
ctxWithInterceptors.runCallable(() -> { // perform the calls which should use the interceptor })
Second option is to mark the newly created EJBClientContext as the new default:
EJBClientContext.getContextManager().setThreadDefault(ctxWithInterceptors);