3 Replies Latest reply on Jul 30, 2007 5:02 AM by damatrix

    Asynchronous call before App Startup

    damatrix

      Hi,
      I'm using JBoss Seam 1.2.1.GA. I've been trying to start an asynchronous process that send out notifications of an event in emaisl immediately the application starts up. This event may have already been configured during a previous run of the application.

      The asyncrhronuous method also needs to have access to an EntityManager to read the details of the event and to a facelet-configured email template.

      The problem is i don't know how to automatically invoke the asynchronous method before the first user even logs in and what scope to outject the list of recepients and data so that the email template can send it.

      I've tried @Startup and @Scope(APPLICATION) but the contexts are not configured at that stage so i get a null pointer.

      Any ideas?

        • 1. Re: Asynchronous call before App Startup
          christian.bauer

          Write an application scoped component that listens for the following event on a method that starts the async procedure:

          @Observer("org.jboss.seam.postInitialization")

          • 2. Re: Asynchronous call before App Startup
            monkeyden

            Is this available in 1.2.1? I searched the source tree but didn't find it.

            Don't mean to bogart the thread but...

            I will try it myself of course but will this work for an EVENT scoped object? I want a component which will start when the application starts and outject some stuff. The reason I want it to be event scope is that once it does it's work, I don't need it anymore.

            • 3. Re: Asynchronous call before App Startup
              damatrix

              Hi,

              I've tried the @Observer annotation on an application scope seam compnonent, and i realise that it is still not being called after startup.

              I've done a search through the seam code and i seam not to find any event being raised by the name "org.jboss.seam.postInitilization" which my method would then observe.

              Is there any other way to do this or am i missing something. Debugging shows that my annotated method is not called at all.