2.12.2008

BlazeDS = AMF/LiveCycle?

I've been lucky over the years to always have someone that can build the back-end data structure for a project. But, as a result, I've let myself become less knowledgeable as I should be on what technologies to use and work best in certain situations. So lately I've been trying to get up to speed in this area and have been playing around with RubyAMF, AMF PHP, and SWX PHP as solutions for Flash/Flex to server communication.

I've been the most impressed with technologies that use AMF (Action Message Format). AMF is a binary format for exchanging data. It's mostly used to transfer data between Flash/Flex applications and a database via a remoting request. In a remoting call, the external elements being called would be application tier services, which would likely be running on an application server such as Adobe ColdFusion, Java, PHP, or .NET.

The major benefits of using AMF for remoting requests are speed and packet size. The use of a AMF binary data transfer format increases performance, allowing applications to load data up to 10 times faster than with text-based formats such as XML or SOAP.

Adobe evangelist James Ward has a Flex application on his site that enables you to run some AMF benchmark tests. Census RIA Benchmark demonstrates various methods of loading data in RIAs and determines how those methods affect performance, bandwidth, and client memory usage.

So, where am I going with this? Well, Adobe released source code for its remoting and messaging technologies under a new open source product named BlazeDS.

An open source Java implementation of AMF, BlazeDS includes technologies that were previously available only as part of LiveCycle Data Services (LCDS) . With BlazeDS, developers can easily connect to back-end distributed data, as well as push data in real time to Flex and AIR applications, for more responsive RIA experiences.

According to Adobe, the company plans to contribute the proven technologies from LCDS to the community through BlazeDS. The two LCDS technologies included in the first release are the Messaging Service and the Remote Procedure Call (RPC) Services:

  • Messaging Service: The Messaging Service provides publish and subscribe messaging for Flex and Ajax applications. Messaging uses the Java Message Service (JMS) to provide real-time communication between connected clients and JMS-compatible application servers, such as ColdFusion. This enables you to create scalable, reliable applications for collaboration and data push, such as chat applications or real-time stock quote applications.
  • RPC Services: The RPC Services (aka Flash Remoting) are designed for applications in which the request/response model is the best choice for accessing data. It enables the use of HTTP services, SOAP-based web services, and Plain Old Java Objects (POJOs) with the efficient AMF 3 protocol. The biggest benefit of using RPC Services in LCDS is the ability to call Java services directly without needing to configure them as SOAP-compliant web services.
It keeps getting less and less expensive to develop Flex applications. The Flex SDK is free and includes a command-line compiler and the entire library of Flex framework class files. BlazeDS will be free and includes some of the functionality from LiveCycle. Its a good time to be a Flash/Flex developer.

Labels: , , , , ,

1.08.2008

Flex (Now LiveCycle) Data Services: A Beginner's Perspective


I got the chance over the last few months to work on a very cool project that required some pretty advanced (well, complex at least) architecture and abilities. I thought of LiveCycle Data Services and decided to look a little more into what it could do.


First, LiveCycle Data Services is really powerful. It includes four basic services that run as "middleware" (i.e. between the server and client sides). The services are Proxy Service, Messaging Service, Data Management Service, and Remote Object Service. My project only required the Messaging and Remote Object services, and believe me, I really only scratched the surface on these technologies. There are many, many cool things you can do with LCDS.


That being said, I wanted to record here a few thoughts and pieces of advice for others who are just starting to get to know this technology.


First, and probably the most daunting for me, was that you're going to have to get to know Java servers. My experience up until this point had been strictly limited to Windows or Linux running Apache, and even in those areas I was practically a beginner. Believe me, it was quite the task to get to learn Java servers. LCDS comes with an installation of Adobe's integrated Jrun server, which I ended up using, although you can use a number of Java servers (JBoss, Jrun, etc).


Second, and you might have seen this coming, but you'll need to get to know Java itself to a degree. I would say this largely depends on the requirements of the project, but for mine luckily it wasn't too bad. Also lucky was the fact that learning to write basic Java classes really wasn't that bad either. ActionScript 3.0 is a great prep :)


Finally, get to know Google. This is kind of tongue-in-cheek, but there were more than a bunch of times that I ran into a wall with either the server, LCDS or Java in general and I spent a lot of time trying to search for answers. One extremely helpful resource that I referred to a lot was David Gassner's Lynda.com series on Flex Data Services. It's slightly outdated, but still contains a lot of relative and extremely helpful tips on building your LCDS project in Flex. Here's a few things I saved for future reference, maybe they can help you out:


  • If you're getting an error with the server with loading MessageBrokerServlet, try this page

  • If you're having some problems with your server not loading classes, you may want to check your jrm variables on your server

  • For the Messaging service, check this page if you're having trouble with RTMP running on port 2038

  • A common error trying to use MySQL involving a "handshake error" is resolved here

  • When configuring your remote object services (remoting-config.xml), be sure to use different names for a channel and service (i.e. channel = "products" and service = "Products")



Hopefully this helps if you're just getting started with LiveCycle Data Services. Again, I really had a blast with this technology overall and hope to be able to use it again in the future. Feel free to post any useful thoughts or pieces of advice you've come across as well!

Labels: , ,