4 Replies Latest reply on Feb 7, 2007 10:18 AM by dahm

    Global Update events/@Observe

    dahm

      Hi,

      consider the following situation:
      I've got a page and a bean containing a @DataModel list. You can click on the list
      and edit one of the entries. Now the list may need an update, because
      the contained data may have changed. The user is free to navigate to
      this page at any time, so the data needs always to be accurate.

      So I raise every time an event when a data item has been changed
      using raiseEvent(). The list SSB accordingly
      contains a method annotated with @Observe() that resets the list.

      This works fine within the same user session. However I'd like to have
      something like a global raiseEvent/@Observe that will forward this event
      to all current sessions, so that all active users always see the most current
      data.
      (I'm aware that there still may be a "lost update" problem :-)

      I don't know how this can be with Seam.

      If this a feature request, I'd suggest that you can scope an event to a
      certain ScopeType which is by default the session context.

      Cheers
      Markus

        • 1. Re: Global Update events/@Observe
          fernando_jmt


          What I did was to add somthing like this:

          <page view-id="/list.xhtml" action="#{listBean.resetList()}">


          And in the resetList() I am reseting the list, in order to refresh the data using the @Factory which updated the list for the respective @DataModel

          • 2. Re: Global Update events/@Observe
            dahm

            Thanks, that is a good idea!

            I'm generating a lot of code and thus can not always maintain pages.xml
            properly in that way.

            I still think the feature I proposed would be a "nice to have" in order
            to propagate events...

            Cheers
            Markus

            • 3. Re: Global Update events/@Observe
              gavin.king

              To share state between "all sessions" you must use application context (or, in a cluster, the PojoCache). There is no way to handle an event in "all sessions" according to the servlet spec.

              • 4. Re: Global Update events/@Observe
                dahm

                APPLICATION scoped events are exactly what I need :-)

                Cheers
                Markus