3 Replies Latest reply on Dec 3, 2013 2:25 AM by wdfink

    @Asynchronous

    fcorneli

      Just notices something when using @Asynchronous methods.

      If you create some JPA entities and then call an @Asynchronous method, these new entities are not visible yet within this method. Even entityManager.flush() is not 100% bullet proof as work around. So I'm forced to fallback to a transacted JMS queue (again).

      If would be nice if you could do something like:

      @Asynchronous(transaction=true)
      public void thisAsynchronousMethodWillOnlyBeInvokedWhenTheCallerTransactionCommits() {
      ...
      }
      

      Could be a feature for EJB 3.next ?

        • 1. Re: @Asynchronous
          wdfink

          What you mean by that?

          Should the @Async call delayed until the calles's transaction is finished or commits (not rolled back)?

          From what I see you nedd to have a surrounding SLSB and annotate the method you call with @RequiresNew and start the @Async after this invocation return.

           

          Also such request is more for JavaEE and not for JBoss, or you need to request a JBoss specific feature.

          • 2. Re: @Asynchronous
            kazaag

            As alternative to JMS, you can use timer which are also part of the transaction.

            • 3. Re: @Asynchronous
              wdfink

              The creation of the timer is part of the transaction, not the execution of it.

              But this might be the wanted behaviour.

              But you need to pass the arguments as Info and you might have issues with the authentication if you need it.