3 Replies Latest reply on Dec 2, 2009 8:29 PM by nickarls

    Event payload

    asookazian

      http://docs.jboss.org/weld/reference/1.0.0/en-US/html_single/#d0e3783


      so when an event is generated/fired, in what scope does it live and/or how long during a user session is it available for observation?  I'm thinking it's scope-independent and observation happens effectively immediately.


      It seems to me that the event firing is synchronous and the observers must observe immediately:



      The event is delivered to every observer method that:
             has an event parameter to which the event object is assignable, and
             does not have any event qualifier except for the event qualifiers that match those specified at the Event injection point.

      So does the container keep track of how many observations were successful or doesn't care?  In the case of an EJB observer in a separate WAR/EAR in the same app server/container, what if it is not immediately available to observe the event(s) at the event firing time?  Is it too bad, so sad or can they have a 2nd chance to observer later?


      Can the observation even happen outside the current app???  Like can a remote EJB observe the fired event(s)???

        • 1. Re: Event payload
          nickarls

          Events are synchronous and doesn't have the concept of scope. Asynchronous observers were dropped from the spec but might make a re-appearance later (well, transactional observers are semi-asynchronous. They happen later but when they are fired, they're synchronous).


          You can use JMS as an event bus also (woohooo!)


          Remote EJB:s can listen to events too. It's just method calls. And if the EJB is not available, well then the application hangs ;-)

          • 2. Re: Event payload
            asookazian

            thx for the answers!  so then there is a need for asynchronous observers. 


            so if the application hangs we must set some timeout config for the event/observe process, no?

            • 3. Re: Event payload
              nickarls

              Dunno, pretty much the same situation you have to deal with normal remote ejb calls (haven't used them that much)...