views:

56

answers:

1

I am currently reading from ActiveMQ with a Message driven bean (EJB3) in the back end. The problem I am facing is that I have to update a table in my JSF page as soon as I receive the message from ActiveMQ in the message driven bean.

Any suggestions of the technologies I can try would be great. I am currently using primefaces and glassfish.

Thx

+1  A: 

You could use primefaces poll to periodically check if there are new messages

<h:form>  
     <p:dataTable id="msgTable" var="msg" value="#{tableBean.messages} ">
     ...
     </p:dataTable>

     <p:poll interval="3"   
             actionListener="#{mdBean.messagesAvailable}" update="msgTable" />  
</h:form> 

See http://97.107.138.40:8080/prime-showcase/ui/ajaxPollHome.jsf for more detail.

StudiousJoseph
Thanks for the response. I ended up using primefaces poll and alerting the other clients via the p:push method in order to alert everyone at the same time. This is however not ideal. The ideal should be that the onmessage() method of the MDB should do something to notifiy all clients that page should update, but I don't know of a way to call a managed bean backend method or similar from the message driven bean. I implemented the activeMQ and MDB as an alert mechanism to not poll the database every few seconds from every client. ActiveMQ message to client...client checks database.
Jaco de Villiers