4 Replies Latest reply on Nov 14, 2010 6:18 PM by Rocky S

    Pushing status from server side?

    Rocky S Master

      I am exploring different ways to push status from server side to the UI when running asynchronous tasks.
      1) Using the standard a4j:push tag and from server side using thread to push status.
      2) Using the standard a4j:push tag and from server side using your custom method to push status basically calling listener onevent.
      3) Using the standard a4j:push tag and from server side using your custom method to push modal panel. This technique will work irrespective of the page the user is currently standing.


      The example given by exadel


      http://livedemo.exadel.com/richfaces-demo/richfaces/push.jsf?c=push&tab=usage



      , it appears this is single thread and global listener, it won't support multiple users.


      In short I do not like any of the above approaches at least in my use case.


      But I do like the status messages that are being pushed on save, update and delete events. It has only 1 cavity this won't work when running asynchronous tasks.
      So I am looking to expand this seam feature when running asynchronous task. So the question is how?

        • 1. Re: Pushing status from server side?
          Leo van den berg Master

          Hi,


          I am still working on this to make it failsafe, but I basically create a Map with the username as key and the Listener as the Value. When you register the Listener you place it in the Map using the current User. I use an observer to listen for user specific messages and after storing it, it triggers the listener. The messages can also be send from time-consuming asynchronous tasks, because I just send an event with the message. I use the growl component (primefaces) to visuzalize the messages.


          I am still working on this because the proces is completely asynchronous, so I had to limit the miber of messages and - more important - you must remove the listener from the Map when the user logs out. This is simple when he does that correctly, but more laborous when he just clicks the close icon (depends on the session time out)


          I you want I can share some tested code , but it needs some additional work.


          Leo

          • 2. Re: Pushing status from server side?
            Gordon Deudney Newbie

            Hello Leo,
            Sorry to thread jack. 
            I have read your other threads where you present this type of solution to deal with JMS messages.  If the code has changed from your previous posting I would appreciate if you can share it.


            I was curious if this solution allows clustering of Jboss?  I recall it was using an application scoped bean, when I looked for reasons why application scope bean cannot be clustered I never found a reason.


            Thanks 

            • 3. Re: Pushing status from server side?
              Leo van den berg Master

              Hi,


              I am not at work at the moment, so I can't send you the code until tomorrow. I've tried different solutions to get async produced messages to the user. When used in combination with JMS, I think it can even be used in a clustered environment. The MDB can use Seam components and especially the Events component can come to the rescue here. When the MB receives a mesage it just re-sends it through the Seam event. Whatever application-scoped bean can pick the message up.


              Additionally I use JMS with an additional username parameter, which can be used for filtering on a Topic.


              As mentioned already in other threads, Seam really misses POJO-JMS integration and especially on the reception part! There are different requests for such functionality (Nikolay posted on and I had another), but they are still not picked up and - dus to the Seam 3 pressure - I doubt if such functionality will be avilable on tyhe short term for Seam 2.


              Leo


              P.S. maybe you should start another thread, because we are miss-using Aman's thread here.

              • 4. Re: Pushing status from server side?
                Rocky S Master

                Thanks guys. I do already have achieved a asynchronous tasks solution, where on the server side, the asynchronous tasks on completion send a jms message and the listener eventually pushes a rich modal component. This is the part of our notification system.
                This solution could be tricky for most of seam users at least for me.


                So I thought why not enhance the existing seam update, delete, save notification messages to run asynchronously. This is what I am looking for and should be an easy solution to implement. I am still researching on this.