Collaborative Data Entry with Flex and BlazeDS

After Yahoo Maps collaboration, here is another example of enabling collaboration in a Flex application using the publish/subscribe messaging infrastructure of BlazeDS.

This example demonstrates “collaborative forms” (or “collaborative data entry”). Users in different locations can fill in forms “together” in a real-time and in-context collaboration session: changes made by one user are automatically reflected in the other users application.

Testing the hosted version

  1. Access http://coenraets.org/collabforms/collabforms.html on two different machines or in two browser windows on the same machine.
  2. Click “Create Session” (bottom left) in one browser: a collaboration session is created with a unique collaboration session id.
  3. Enter this collaboration session id in the other browser and click “Join Session”.
  4. Change the selected Accordion tab in one browser, and notice that the Accordion in the other browser is automatically synchronized.
  5. Enter data in one browser and notice that the information is automatically synchronized in the other browser.
  6. On the Employment History tab, add a few companies (including start date, end date, and salary) and notice that the employment history list is automatically synchronized in the other browser.

You can right-click the application and select View Source or click here to see the source code of the application.

Notes:

  1. The way a collaboration session is actually started may vary depending on the application. In this example, one user creates a collaboration session, and shares the collaboration session id (via email, IM, etc…) with people he/she wants to collaborate with. In other use cases, the collaboration session could start automatically. For example, in a call center scenario, a user might click a “Live Help” button which would result in the creation of a support ticket appearing in the Support Reps application. A support rep could then take ownership of the ticket and enter a collaboration session using, for example, the ticket id as the collaboration session id. I will post a call center version of this example in the coming days.
  2. In this example, the synchronization is performed using pub/sub messaging. You could also use the Data Management Service available with LiveCycle Data Services to automatically keep data in sync between multiple clients.
  3. The hosted version of the application first tries to connect to the server using RTMP (available only as part of LCDS), and falls back to “long AMF polling” or regular AMF polling if the RTMP connection fails.

Local installation instructions:

  1. Install BlazeDS. You can download the BlazeDS turnkey server (a version of Tomcat with BlazeDS preinstalled) here.
  2. If you don’t already have a channel called “my-longpolling-amf”, open {blazeds-install-dir}/tomcat/webapps/samples/WEB-INF/flex/services-config.xml and add an AMF long polling channel defined as follows:
    <channel-definition id="my-longpolling-amf" class="mx.messaging.channels.AMFChannel">
    	<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amflongpolling" class="flex.messaging.endpoints.AMFEndpoint"/>
    	<properties>
    		<polling-enabled>true</polling-enabled>
    		<polling-interval-seconds>5</polling-interval-seconds>
    		<wait-interval-millis>60000</wait-interval-millis>
    		<client-wait-interval-millis>1</client-wait-interval-millis>
    		<max-waiting-poll-requests>200</max-waiting-poll-requests>
    	</properties>
    </channel-definition>
    
  3. Open WEB-INF/messaging-config.xml and add the following destination:
    <destination id="mortgage">
    	<channels>
    		<channel ref="my-longpolling-amf"/>
    		<channel ref="my-polling-amf"/>
    	</channels>
    </destination>
    
  4. (Re)start the BlazeDS turnkey server.
  5. Download the source code of the Mortgage Application here.
  6. Create a Flex Builder project for the Flex application (collabforms). Make sure you configure your Flex Builder project to work with BlazeDS. To read instructions on how to set up a Flex Builder project that works with BlazeDS, make sure your BlazeDS turnkey server is started, and click here.
  7. Compile the application.
  8. Open the Flex application in two browser windows (to simulate two users in different locations) and test the application as described above (in “Testing the hosted version”).



  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • LinkedIn
  • StumbleUpon
  • Twitter
This entry was posted in Flex. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

35 Comments

  1. Posted April 8, 2008 at 3:42 am | Permalink

    Cool example !!!

    Blaze DS + Flex SDK + J2EE = The best openSource solution

  2. William from Lagos
    Posted April 8, 2008 at 8:27 am | Permalink

    Just awesome! I love it.

  3. Posted April 8, 2008 at 2:48 pm | Permalink

    Christophe, Is there a way around having to edit the messaging-config.xml file everytime someone adds a Flex application that uses messaging?

    I can see where an admin will get real tired having to do this every day.

  4. Mete Atamel
    Posted April 8, 2008 at 9:27 pm | Permalink

    Gary, you can dynamically (with Java code instead of xml) create a messaging destination without having to modify messaging-config.xml. This can either be done via an AbstractBootstrapService (that gets called as the server starts up) or with a Java class that can be called via RemoteObject.

  5. Posted April 9, 2008 at 9:52 am | Permalink

    Is the BlazeDS subtopic filtering done on the client side or the server side? If its on the client side, wouldnt that expose serious security issues?

  6. Posted April 9, 2008 at 10:07 am | Permalink

    Vijay,
    The filtering is done at the server-side.
    Christophe

  7. Posted April 11, 2008 at 8:55 am | Permalink

    What should I do to get this example working in Granite DS?

  8. Mathieu
    Posted April 17, 2008 at 4:01 am | Permalink

    Hi,

    First of all, thank you for your blog, this is a mine of information.

    However, I’ve got 2 questions :
    - What’s the difference between polling and long-polling and pushing technologies ?
    - How can I use pushing with AMF ?

    Thanks for all in advance.

  9. Posted April 18, 2008 at 10:33 am | Permalink

    Mathieu,
    Damon has a good blog post that answers your questions in detail:
    http://www.dcooper.org/Blog/client/index.cfm?mode=entry&entry=8E1439AD-4E22-1671-58710DD528E9C2E7

  10. Mathieu
    Posted April 21, 2008 at 2:33 am | Permalink

    I already read this artcile but I can’t understand some details (I’m not English). I come back to it and read it again trying to understand better.

    Thank you for reply.

  11. Posted April 23, 2008 at 7:46 am | Permalink

    Hi,
    I enjoy so much this example. Thanks a lot for providing it ! I used this source to build my own “collaborative form” application.

    With the accordion, no problem… but I’m now trying to integer it into a “wizard” form navigation based on HBox element, inspired by the example there :http://blog.kevinhoyt.org/2007/02/18/thoughts-on-accordion-usability/

    No problem for propertyChange events, data is copied, but I can’t manage to exchange forms view when the wizard pages switches (you’re using IndexChangedEvent with the accordion but this event is not applicable to HBox…)

    here is a sample of code :

    Any idea ?

    I hope you’ll understand my English (sorry…) and my problem…

    Thanks a lot if you can help !

  12. Posted April 23, 2008 at 7:53 am | Permalink

    Oops, It seems like posting source code is not allowed.

    Just another thing (one post, one subject…)

    There is a problem with the DateField property which has random results… The binding seems to have a problem, only the session initiator can change it. When the person who join the session try to modify it, the old date immediately goes back… (I tried various ways, everytime the same result).

    Have a nice evening :-)

  13. Posted April 30, 2008 at 5:26 am | Permalink

    Good morning,

    I finally found myself issues for my two previous problems.

    Here is the way I solved the DateChosser binding problem :

    - In the Model, I declare the “Date” property as a String :
    public var dateNaissance:String = “”;

    - In the forms, I’ve put a DateField component binding its text attribute :

    And finally the binding of the DateChooser.text with the model text variable :

    There may exist a better way, but I hope this could help !

    I just discovered your updated version, which I found so exciting. Waiting for the source code to be published ! Thanks again.

  14. Posted May 2, 2008 at 1:03 pm | Permalink

    Hi Cristophe,

    thanks for this great example.
    Don’t know what it’s like in the US right know but a example about mortgages is daring ;)

    Quote of Edgar who says it right :
    Blaze DS + Flex SDK + J2EE = The best openSource solution

  15. kobe
    Posted May 30, 2008 at 10:51 am | Permalink

    hey
    thank you for sharing this website

  16. adg
    Posted June 2, 2008 at 8:49 am | Permalink

    application always gives a bug in firefox
    after some time:

    flash player version 9,0,124,0

    firefox 2.0.0.14 (windows xp)

    –> unhandled exception in browser
    (+”debug in visual studio?” question)

  17. Posted June 4, 2008 at 12:36 am | Permalink

    Just for those who want to have a Coldfusion version of this app :

    in the messaging-config.xml, just ad this :

    to the end of the document…

    Restart the Coldfusion server

    and all works fine ! ;)

    regards

  18. Posted June 4, 2008 at 12:38 am | Permalink

    ok.. no source codes here, so go to Adobe Devnet Christophe article at :

    http://www.adobe.com/devnet/flex/articles/data_entry.html

  19. Posted August 22, 2008 at 5:27 am | Permalink

    hey
    thank you for sharing this website

  20. Posted August 28, 2008 at 3:33 pm | Permalink

    thank you for sharing this website

  21. Posted September 25, 2008 at 5:48 am | Permalink

    This looks really awesome, great transparency-style. I also want to thank you, as we are searching for new ideas and styles to improve our homepage.

  22. Forrest
    Posted November 26, 2008 at 12:54 am | Permalink

    it’s not work on my mochine ,and on the FlashPlayer 10!!!!

  23. Posted January 7, 2009 at 1:24 pm | Permalink

    There may exist a better way, but I hope this could help !

    I just discovered your updated version, which I found so exciting. Waiting for the source code to be published ! Thanks again.

  24. Posted January 18, 2009 at 12:20 pm | Permalink

    Hi all,
    i am a coldfusion developer and a flex aspirant. i want to know how we can integrate flex with blazeds and coldfusion. i dont know much abt blazeds. Can i make a chat applicatin in coldfusion with blazeds support and integrate in a flex site? is that possible? any tutorial links would be helpful..thnx..

  25. Posted February 26, 2009 at 6:10 pm | Permalink

    This is a new thing for me, but i am glad that i came hear and make a know about this subscribe messaging infrastructure for data entry.

  26. Posted March 17, 2009 at 8:52 am | Permalink

    Hi all,
    i am a coldfusion developer and a flex aspirant

  27. Posted March 17, 2009 at 4:59 pm | Permalink

    Thanks a lot if you can help !

  28. Posted March 23, 2009 at 7:54 am | Permalink

    This appears good information shared in this post.

  29. Posted March 25, 2009 at 5:09 pm | Permalink

    Trying to figure out php, I know coldfusion is powerful.

  30. Posted May 16, 2009 at 5:04 am | Permalink

    Да,несогласен с предыдущими высказываниями
    ) Bye

  31. Posted August 31, 2009 at 1:16 pm | Permalink

    Thank you! I really like this. If want buy? I recommend this site: http://www.diymyhair.com. They are a good seller.

  32. Posted September 10, 2009 at 5:11 pm | Permalink

    Hi! I was surfing and found your blog post… nice! I love your blog. :) Cheers! Sandra. R.

  33. Posted September 21, 2009 at 11:50 am | Permalink

    Sign: yyams Hello!!! punht and 843dhursyvpxd and 7004 My Comments: Cool!

  34. Posted October 7, 2009 at 12:42 pm | Permalink

    Sign: gfndc Hello!!! cbatx and 6399ckxbucncks and 5857 : I like your blog. cool post!

  35. Joe
    Posted December 3, 2009 at 11:31 am | Permalink

    In this example is your web server using livecycle or blazeds? I ask b/c using my localhost (I only have blazeds setup) I cannot get this example to work. Other samples (gmaps, etc.) work but not this one.

8 Trackbacks

  1. By Reboxetine. on July 14, 2008 at 3:50 pm

    Vestra reboxetine….

    Vestra reboxetine. Reboxetine edronax. Reboxetine….

  2. By Atomoxetine and drug abuse liability. on July 19, 2008 at 4:01 pm

    Atomoxetine generic….

    Atomoxetine hci….

  3. By Reboxetine. on July 20, 2008 at 4:21 pm

    Vestra reboxetine….

    Vestra reboxetine….

  4. By lär dig craps on July 20, 2008 at 5:29 pm

    lär dig craps…

    idleness Carletonian?soldierly climbing engraver deafen!…

  5. By Vestra reboxetine. on July 21, 2008 at 3:54 pm

    Reboxetine….

    Vestra reboxetine. Reboxetine edronax. Reboxetine….

  6. By Cooking classes houston tx. on August 2, 2008 at 7:01 pm

    Leisure cooking classes houston texas….

    Recreational cooking classes. Cooking classes in ventura county. Cooking classes for kids. Austin cooking classes. Whole foods market cooking classes. Cooking classes chicago. Cooking classes west palm beach florida. Vegatarian cooking classes. Informa…

  7. By Blazeds « It’s all about RIA on October 16, 2008 at 3:36 am

    [...] Christophe Coenraets :: Collaborative Data Entry with Flex and BlazeDS [...]

  8. By click to view on March 10, 2009 at 10:23 am

    click to view…

    Here is some more information you can use….

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>