Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-11218

Outdated procedure for adding EJB client-side interceptor

    XMLWordPrintable

Details

    Description

      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);
      

      Attachments

        Activity

          People

            rhn-engineering-nchaudha Nidhi Chaudhary
            jmartisk@redhat.com Jan Martiska
            Jan Martiska Jan Martiska
            Jan Martiska Jan Martiska
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: