5 Replies Latest reply on Jul 11, 2012 9:44 AM by wesjanik

    Client-Side EJB Interceptor in AS7

    wesjanik

      Hello-

       

      I'm trying to come up with a mechanism to provide out-of-band data to vanilla (server-side) EJB interceptors from a remote client.  In searching for a solution I came across bug https://issues.jboss.org/browse/AS7-5021 which seems to describe exactly what I'm looking to do.  However, I can't seem to find any information on how to configure one of these client-side EJB interceptors.  I've found the EJBClientInterceptor class along with some mention to registrations, but I'm struggling to understand how it all fits together.

       

      Anyone know if there's some good info on how to use these client-side interceptors in AS7?

       

      Thanks in advance,

         -Wes

        • 1. Re: Client-Side EJB Interceptor in AS7
          michael_gronau

          Hi Wes,

           

          It is pretty easy as far as you have a connection established to the server. After this you can try to get the current EJBClientContext with EJBClientContext().getCurrent(). On this context object you can register your own ClientInterceptor ( a class that implements EJBClientInterceptor). with EJBClientContext.registerInterceptor.

           

          Thats all, very easy ;-)

           

          Greets,

          Michael

          • 2. Re: Client-Side EJB Interceptor in AS7
            wesjanik

            That is easy, thank you!

             

            What is the scope of the registration?  In other words, if I want to register a single interceptor for all calls on every thread, do I need to keep re-registering?  The JavaDocs seem to leave vague (I'm assuming on purpose) the scope of both the registration and the EJBClientContext.

            • 3. Re: Client-Side EJB Interceptor in AS7
              jaikiran

              Wesley Janik wrote:

               

              That is easy, thank you!

               

              What is the scope of the registration?  In other words, if I want to register a single interceptor for all calls on every thread, do I need to keep re-registering?  The JavaDocs seem to leave vague (I'm assuming on purpose) the scope of both the registration and the EJBClientContext.

              The interceptors will be applicable for all invocations using that context (which typically spans the lifetime of the application). So registering those interceptors is a one time thing and you can just keep invoking on the EJBs without having to re-register the interceptors.

              • 4. Re: Client-Side EJB Interceptor in AS7
                jaikiran

                Wesley Janik wrote:

                 

                The JavaDocs seem to leave vague (I'm assuming on purpose) the scope of both the registration and the EJBClientContext.

                It wasn't on purpose. No one provided review comments on those, so it just didn't get added. I'll include this scope part in the javadoc upstream.

                • 5. Re: Client-Side EJB Interceptor in AS7
                  wesjanik

                  Perfect - thanks much, guys!