|
Replies:
3
-
Last Post:
Apr 30, 2008 10:08 AM
by: sendtopms
|
|
|
|
|
|
|
How to make Comet Extensible
Posted:
Apr 24, 2008 11:38 PM
|
|
|
I am currently proposing Architecture based on Comet on Glassfish for an enterprise application. One of the nice feature in GF is Comet. I looked at few comet samples like chat, echo etc on GF. My question how can I expose changes in other enterprise components, for example, ejb3.0 to be pushed to the client which uses Dojo cometd? I did not find any extension point in com.sun.grizzly.cometd.servlet.CometdServlet! Is there any other way which I missed? I read through most comet related blogs but not able to find an answer for the above question. Basically I am looking for integration point using which I can hook messages from other entity componets which detect the data to be pushed to the client.
Please guide me on this. Expecting reply.
Thanks in Advance, Senthilkumar.
|
|
|
|
|
|
|
Re: How to make Comet Extensible
Posted:
Apr 29, 2008 8:44 AM
in response to: sendtopms
|
|
|
Did you read this blog entry?
http://weblogs.java.net/blog/jfarcand/archive/2006/07/the_grizzly_com.html
CometdServlet is an example of the usage of the relevant classes.
You should look specifically at CometHandler, CometEngine and CometContext. CometdServlet on the other hand should just be used as an example of how to use these classes.
Also have a look at the other blog entries by Jean Francois. They contain further information about Glassfish's/Grizzly's comet API.
-- Wolfram Rittmeyer
|
|
|
|
|
|
|
|
Re: How to make Comet Extensible
Posted:
Apr 29, 2008 8:53 AM
in response to: writtmeyer
|
|
|
Grrr looks like when I reply using mail, the forum is not extended I've been in touch with Senthilkumar and we will soon post (or blog) about how to extend Bayeux support from an EJB Shing-Wai and I will update the forum once we have fully tested the solution
A+
-- jeanfrancois
|
|
|
|
|
|
|
|
Re: How to make Comet Extensible
Posted:
Apr 30, 2008 10:07 AM
in response to: jfarcand
|
|
|
I got the solution with the help of JFA, In short, The following snippet of code will enable to post/push message to channel in the Context. String message = "<<Your message>>"; String user = "<<who am I>>";
HashMap<String, Object> map = new HashMap<String, Object>(); map.put("chat", message); map.put("user", user); Data data = new Data(); data.setMapData(map); data.setChannel("/chat/demo"); data.setClientId("ejb6312"); CometEngine cometEngine = CometEngine.getEngine().getCometContext(contextPath).notify(data); Note: HashMap and Data is a wrapper to create a bayeux message of the following form /*[{"successful":true,"channel":"/chat/demo","timestamp":"Wed, 30 Apr 2008 15:43:34 GMT","id":"5"},{"id":"5","timestamp":"Wed, 30 Apr 2008 15:43:34 GMT","data":{"chat":"<<Your message>>","user":"<<who am I>>"},"channel":"/chat/demo"}]*/.
Please look at the below link for more details http://forums.java.net/jive/thread.jspa?messageID=272256񂞀
Thanks, Senthilkumar PM
|
|
|
|
|