| By Brian Albers | Article Rating: |
|
| February 25, 2008 04:00 PM EST | Reads: |
10,752 |
JMS Destinations can be either looked up by well-known persistent names, or created with a temporary scope. For instance, a site can create a series of poker tables that a user can choose to watch, each with unique names such as "HighStakes" or "Novice." Accordingly, "HighStakes" and "Novice" would be the public names of the JMS topic to which any client would attach. Then, any messages sent to the corresponding "HighStakes" or "Novice" JMS topics on the server would be immediately pushed to only those clients who were interested in them.
Private messages are also supported by such a mapping. In JMS, there is the concept of a temporary Destination, which is scoped to the duration of a communication session. This provides a convenient way for clients and servers to attach and detach short-term channels as necessary. If, for example, there existed a well-known public JMS Queue named "HighStakesSeatRequests" where observers could send messages to attempt to sit and play at the HighStakes table, the corresponding client JMS code might look something like this:
ObjectMessage seatRequestMessage = myPokerSession.createObjectMessage();
// ...
// Fill in pertinent seat reqeuest information on the seatRequestMessage
// ...
Queue myPrivatePlayerQueue = myPokerSession.createTemporaryQueue();
seatRequestMessage.setJMSReplyTo(myPrivatePlayerQueue);
myPokerSession.send(seatRequestMessage);
In JMS terms, the temporary queue's name is not important, and is usually a generated value such as "xyz123". But by creating it and setting it as the "replyTo" field, any receivers of this message - such as the server handling the seat request - can store that temporary Queue for future direct messages to that client. Notably, the server/dealer can use this temporary queue to notify that client/player if his seat request was accepted or rejected. Securing that channel is beyond the scope of this article, but it goes without saying that security through channel name obscurity is not sufficient when critical data is being transported!
Kaazing's Enterprise Comet technology supports this API by mapping the JMS APIs to Comet transports and protocols such as Bayeux and JSON. However, the application development team gets the benefit of working against the strongly typed, yet simple, JMS standard.
A Winning Combination
Translating JMS code to
Comet may not be the most obvious solution for real-time programming,
but it comes with real benefits. Besides the transfer of knowledge from
experienced Java EE programmers, working directly against JMS APIs
allows a multitude of existing back-end messages to extend their reach
into the client - and vice-versa - without forcing the client or server
to undergo a mapping transformation. While JMS poker applications may
not be ubiquitous, monitoring and business logic messages are. Allowing
a real-time Web client to handle such messages opens up the possibility
for Java Swing-based clients that talk natively to JMS to be replaced
with AJAX equivalents. Or, if coexistence is preferred, an AJAX client
can live alongside a Swing peer, as both will be able to communicate
with the back-end business logic via JMS Destinations.
This was put to the test with our own poker application, which was largely built and tested using a simple Swing client while the AJAX client was under development. The AJAX poker application was then able to speak to the shared back end by translating the Java JMS calls to our underlying Comet support. Both client types and the server can work against the same Java Object model. Cards, players, and tables run on both tiers, but are defined and implemented once. Messages can be strongly typed, with no need to drop down to text or XML. It's a refreshing way to write a Web client.
This is only one example of how an established Java API can be integrated into AJAX client development. Due in no small part to Java's head start, the pool of Java developers vastly outnumbers those with AJAX development experience. Bridging successful Java APIs to an AJAX client is a great way to expand the pool of AJAX developers and also expand the capabilities of your applications.
Resources
• Comet: http://en.wikipedia.org/wiki/Comet_(programming)
• Java Message Service: http://java.sun.com/products/jms/
• Firebug: www.getfirebug.com/
• AJAX in ActiveMQ: http://activemq.apache.org/ajax.html
• Enterprise Comet: http://kaazing.com/collateral/kaazing_overview.pdf
Published February 25, 2008 Reads 10,752
Copyright © 2008 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Brian Albers
Brian Albers has over 11 years of experience in the field of user interface technologies. Prior to joining Kaazing, Brian worked as Senior Development Manager at Oracle, where he led the planning and designing of the next generation of Oracle's UI technology, an effort publicly known as ADF Faces. During his 10 year tenure at Oracle, Brian worked primarily on mixing cutting-edge technology with large enterprise demands (internationalization, accessibility, scalability). He proposed the open source donation of ADF Faces, which ultimately became the Apache MyFaces Trinidad project. Brian led a cross-team effort to develop a DHTML rich client and a mobile client presentation layer for Oracle's upcoming Project Fusion.
In his career, Brian has focused on simplifying complex UI programming models for widespread use, while maintaining backwards compatibility and keeping future flexibility, which now pays dividends in Oracle's effort to move older technologies to it's Fusion stack. Brian received a BS degree in Computer Science from the University of Texas, Austin, and a BA degree in Plan II Honors from the University of Texas, Austin.
- 4th International Cloud Computing Conference & Expo Starts Today
- Cloud Expo New York Call for Papers Deadline December 15
- Wave on Ulitzer: Confessions of a Google Wave Fanboy
- GovIT Expo Highlights Cloud Computing
- Google Wave
- Adaptivity & Cloud Computing: Exclusive Q&A with CEO Tony Bishop
- Cloud Computing Can Revitalize Your Career as Software Developer
- Oracle+MySQL Opponents Take to the Barricades
- Virtualization Expo Call for Papers Deadline December 15
- Vivek Kundra: "Engage the American People in their Daily Digital Lives"
- Instant Professionalism Online Despite Yourself...with Ulitzer
- Software Should Be Creative
- 4th International Cloud Computing Conference & Expo Starts Today
- Yahoo! Named “Platinum Sponsor” of Cloud Computing Expo
- Deputy CIO of the CIA to Keynote 1st Annual GovIT Expo
- Cloud Expo New York Call for Papers Deadline December 15
- Cloud Computing Expo: Exclusive Q&A with Yahoo! SVP Cloud Computing
- Wave on Ulitzer: Confessions of a Google Wave Fanboy
- GovIT Expo Highlights Cloud Computing
- Google Wave
- Live Demo of Yahoo! Query Language to be Given at 4th Cloud Computing Expo
- Adaptivity & Cloud Computing: Exclusive Q&A with CEO Tony Bishop
- Cloud Computing Can Revitalize Your Career as Software Developer
- IBM Goes After Gmail
- Where Are RIA Technologies Headed in 2008?
- Personal Branding Checklist
- The Top 250 Players in the Cloud Computing Ecosystem
- Wal-Mart To Sell $399 Ubuntu Linux-based Laptop with Google Operating System
- Google's OpenSocial: A Technical Overview and Critique
- Why Microsoft Loves Google's Android
- Web 2.0 Is Dead And It's Time To Get Out Of This Mess!
- i-Technology Blog: Google Trends on Java, McNealy, AJAX, and SOA Give Pause For Thought
- Android: Who Hates Google Over the Phone?
- Google Sales Surge 57% and Net Income 46% in Quarter 3
- i-Technology Blog: Is There Life Beyond Google?
- Social Network Wars: Google + Everyone Else vs Facebook





























