1 Reply Latest reply on May 17, 2006 10:00 PM by bdecoste

    Interceptors AFTER biz method invocation

      Hi,

      Using JBoss AS 4.0.3 and EJB3.0 RC5.

      We'd like to send a jms message after an entity instance is modified (merged).
      A business method in a stateless bean is called, it does the merge and then we'd like to send the notification.

      How we can send this message after the method execution when we are sure that the entity is persisted?
      ejb3.0 Interceptors seem to be for use only before execution.

      There's another way using interceptors?
      Should we use plain JBoss AOP for this?

      regards,

        • 1. Re: Interceptors AFTER biz method invocation
          bdecoste

          Interceptors can be used to before and after execution by using the try/finally pattern:

           @AroundInvoke
           public Object invoke(InvocationContext ctx) throws Exception
           {
           try
           {
           // code to be executed before execution
           return ctx.proceed();
           }
           finally
           {
           // code to be executed after execution
           }
           }