Live propagation of DataGrid / ArrayCollection when changing values in Flex application
I've seen a bunch of screencasts demonstrating the integr开发者_开发百科ation between blazeds and flex, also some lcds tutorials, model driven or not.
I've seen that some of them the presenter opens 2 browsers and once you change one value in a grid, it propagates to all other grids that presents the data.
I am wondering how the heck this is done, and how to reproduce.
Does this feature depends of the Edge / LCDS solution? I don't think so, but I've never seen some code explaining about it.
I feel it may or may not rely on JMS / MQ / messaging protocols or if this is some sort of 2 way sync and propagation of collection between instances of the same service result.
Thanks for any inputs.
Cheers,
Ernani
You can implement this feature both with BlazeDS and LiveCycle Data Services. BlazeDS provides remote and messaging features (the messaging features is the one allowing you to synchronize the data between the clients), LCDS extends BlazeDS adding new features like data management (productivity improvements), PDF generation, EDGE server for dealing with DMZ zones), MDA development, portal integration etc. It also adds some advanced messaging features like message conflation, throttling, reliability.
BlazeDS is free and open source and in my opinion a robust solution, you can use it if you want to synchronize the data between clients. LCDS adds a lot of things, but the LCDS customers should have a large budget.
How does it work? There is no JMS behind for this feature (however BlazeDS can integrate with a JMS provider so you can have one client in broswser and the second one running a SWING application). Instead there are some message queues on the server and a publisher - subscriber graph. In order to push the data from the clients to the server there are several choices, the more advanced are available only on LCDS: HTTP polling, HTTP long polling, HTTP streaming, RTMP sockets (LCDS only). All of them are described in details on Damon blog.
If you want to see some code go and download BlazeDS and take a look on the samples, there are several ones showing the messaging features. Also there a tomcat server is bundled in the download, and the samples are already deployed in it.
To do this you need to keep an open socket connection between the client and the server so that the server can push data back to the client.
I believe that the RTMP protocol was used for this two-way communication.
I understand that this is the primary reason to use LiveCycle Data Services over BlazeDS. WebORB also has push functionality, as does GraniteDS. I've also seen demos where this is done with ColdFusion.
If none of those options are available to you, you're stuck doing some kind of polling to the remote server.
Unfortunately, I do not have specific code samples to share.
A simple sample showing how to do this using WebORB can be found here: http://www.kensodev.com/2009/11/01/synchronize-client-application-using-flexweborb-net/
That sample is based on WebORB 3 for .NET; WebORB 4 is now available, for both .NET and Java.
Point being: This is brain-dead simple using WebORB, which is FREE (although a paid Enterprise version is also available). God forbid that anyone should shell out $30K for LCDS just to get this feature.
--- Jim Plamondon, Midnight Coders (makers of WebORB)
精彩评论