4 Replies Latest reply on Oct 21, 2013 6:49 AM by sjashe

    RF4, a4j:push, and broadcast

    liuliu

      hi,

       

      i am trying to use a4j:push to send a system message to all user connected. i have a application scope bean, it creat a topic, a a4j:push in the template with this address. i publish a message on this address when needed.

       

      but it works only one time after load the page. Is this the right way to do this?

       

      thanks in advance

       

      liu

        • 1. Re: RF4, a4j:push, and broadcast
          bleathem
          • 2. Re: RF4, a4j:push, and broadcast
            liuliu

            yes, it works with cdi push.

             

            but could you enlighten me on the difference between a richface message queue and a cdi event, and do they have a scope? how to tell the push to use a websocket connection than a long-polling mothod?

             

            thanks

            • 3. Re: RF4, a4j:push, and broadcast
              bleathem

              RichFaces push has the option to work with JMS, where you publish a message to a JMS message queue and that message observed by RichFaces Push and transported via Comet to the client.  Using JMS with RichFaces push gives you all the usual JMS advantages: Asynchronous, reliable, etc.


              RichFaces push also has the option to work without JMS.  You can use the RichFaces Push API to transport messages directly to the client.


              CDI is an API.  You can use the RichFaces push CDI API with or without JMS.


              To use Websockets, you'll have to deploy to a container that uses websockets.  Then Atmosphere should recognize and use websockets over comet - it's been a while since I played with this, so feel free to post back if you are having trouble getting the websockets going.


              Clear?

              • 4. Re: RF4, a4j:push, and broadcast
                sjashe

                Not fully clear myself..

                 

                If you use CDI for push, it only stays within the session, right?  To push a message to all users you would need something like Push using JMS? or can Push CDI events do such?

                 

                Using the showcase examples and richfaces documentation, I have succeeded in getting JMS Push working.. except that right now the event.fire succeeds in sending a message to the topic, but only push consumers on remote machines receive it. A consumer running on the server machine does not.

                 

                Does atmosphere work differently for a local connection vs remote?