LCDS 3.1 and BlazeDS 4.0 are out

LCDS 3.1 and BlazeDS 4.0 are officially out. You can get LCDS 3.1 from here and BlazeDS 4.0 from here.

Documentation has been updated as well:

  • Using LiveCycle Data Services ES2 version 3.1 HTML | PDF
  • LiveCycle Data Services ES2 Release Notes version 3.1 HTML
  • LiveCycle Data Services ES2 version 3.1 Javadoc HTML
  • ActionScript 3.0 Reference for the Adobe Flash Platform HTML

Aside from the features, I’m equally excited about the number of bugs that have been fixed in this release. Take a look at the release notes for the full list.

Monitoring BlazeDS and LCDS applications

Not sure how many people know about this but most of BlazeDS/LCDS server classes are exposed as JMX MBeans which means they can be viewed with a JMX enabled client such as jconsole. Additionally, BlazeDS/LCDS comes with a simple application called ds-console that can be used to view these MBeans as well. These MBeans provide information about the state of the server such as number of Flex Sessions, number of Flex Clients, command counts, message counts, along with some performance related info. If you want to check it out yourself, here’s what you need to do.

First, you need to make sure manageable flag is set to true in services-config.xml (by default, it’s enabled). This makes sure MBeans are created and exposed via JMX server. You can turn off management if you don’t want your application to be available via JMX or for other reasons (eg. Goggle App Engine does not support JMX for example).

Then, you can start your application along with ds-console application. Ds-console has a few tabs but I think the “Generic Administration View” is the most useful one. It shows all the exposed MBeans in a tree like structure:

DSConsole application.

You don’t actually need ds-console to see these MBeans. You can use jconsole that comes with Java. Setup is pretty easy. As you first start your server, you need to make sure JMX is enabled. You can do this in a number of ways but one easy way to set the following Java option in the terminal and start the server.

export JAVA_OPTS=-Dcom.sun.management.jmxremote

Then, simply start jconsole from the terminal and attach to your server. You should see the same tree view in jconsole:

JConsole application
JConsole application

AMFConnection for AMF remoting in Java

In couple posts back, I talked about using NetConnection to talk to a remoting destination in BlazeDS/LCDS. This helps for pure Flash clients talk to BlazeDS/LCDS but what if you have a Java client app and you want to do a remoting call from your Java app, is this possible? That’s when AMFConnection comes into play.

I created this nice little class in BlazeDS source tree a while back. It tries to mimic Flash’s NetConnection in Java (hence the name AMFConnection) and inspired by Peter Farland‘s AMFConnection. It uses BlazeDS’ AMF serializer/deserializer (which means you need flex-messaging-common.jar and flex-messaging-core.jar from BlazeDS in your classpath) and it can potentially be used from any Java code to serialize/deserialize AMF messages. Internally, Java’s HttpURLConnection is used to send/receive HTTP request/replies and can be used to perform remoting calls to BlazeDS, LCDS, or any other server technology that understands AMF from your Java client.

You would use AMFConnection pretty much like NetConnection. One notable difference is that calls are not asynchronous which makes sense for Java. Here’s a brief example:

// Create the AMF connection.
AMFConnection amfConnection = new AMFConnection();

// Connect to the remote url.
amfConnection.connect("http://localhost:8400/team/messagebroker/amf");

// Make a remoting call and retrieve the result.
try
{
Object result = amfConnection.call("remoting_AMF.echo", "Hello World!");
}
catch (ClientStatusException cse)
{
// Handle exception.
}
catch (ServerStatusException sse)
{
// Handle exception.
}

// Close the connection.
amfConnection.close();

A full example can be found in this JUnit test in BlazeDS source tree.