NetConnection and remoting in BlazeDS/LCDS

Normally, people use RemoteObject to talk to a remoting destination in BlazeDS which is a class part of Flex framework but once in a while, I get questions on whether it’s possible to do remoting with Flash’s NetConnection directly. Although using NetConnection has no immediate benefits, it’s helpful in case one does not want to use Flex framework or simply prefer using NetConnection.

Thanks to LegacyFilter in BlazeDS, this is indeed possible. Here’s an outline of what you need to do. First, create a NetConnection and connect to the URL of the endpoint you need to connect (which is defined in services-config.xml)

var nc:NetConnection = new NetConnection();
nc.connect("http://localhost:8400/team/messagebroker/amf" );

Then, do the NetConnection call with a special parameter, result/fault responders, and arguments to the remoting method.

nc.call( "remoting_AMF.echo", new Responder( resultHandler, faultHandler ), "hello");

The first parameter is important, the format is destinationId and method name seperated by a dot. In this example, we’re asking BlazeDS to direct the request to destination with id “remoting_AMF” and the “echo” method of the class that the destination exposes. LegacyFilter handles the rest. A full example is here in BlazeDS source tree.

Advertisements

Flash Builder4 Beta1 to Beta2

My Eclipse had been complaining about some license expiration for a while that I kept ignoring. Today I finally decided to fix it but the message was not terribly useful as seen below:

License Expired

Which product I kept wondering…but I figured out that it was Flash Builder 4 Beta plugin when I could not open my MXML/AS files in Eclipse anymore. I guess this is one way of informing people about product license expiration: throw some mystery in the intro, keep people wondering, and hit people when they need to use the plug-in for the “AHA! This was it” moment 🙂

Anyhow, I’m terrible when it comes to product version numbers, so first I had to find out which version of Flash Builder 4 Beta I had. I had build 235740, and after some Googling, I figured out that it was Beta1. (Wouldn’t it be nice if Flash Builder told me this in addition to the build number?)

I just wanted the warning to go away and to open my AS/MXML files and didn’t really care about Beta2 features just yet, so my first instinct was to use Beta2 serial number in my Beta1 install. Unfortunately, I couldn’t find a way to enter serial numbers anywhere in my Eclipse/Flash Builder. I remember seeing this at some point but it simply vanished. Regardless, I wasn’t so sure whether I could use Beta2 serial number with Beta1 install anyway.

I posted to Adobe forums and someone informed me that you need to install Beta2 in order to use Beta2 serial numbers, as I suspected. So, as I’m downloading my 363MB Flash Builder Beta2 plug-in (which is build 253292 by the way) I wanted to let people know that you need to get rid of Beta1 and install Beta2 in order to continue editing your AS/MXML files again.

Adobe MAX 2009 session

I had a session at Adobe MAX 2009 named “High-Performance Real-Time Messaging wit Flex and Livecycle Data Services” where I talk about the different real-time communication options in Livecycle Data Services and also the new exciting messaging features in Livecycle Data Service 3.0 release. The recording is posted at Adobe TV:

http://tv.adobe.com/watch/max-2009-develop/highperformance-realtime-messaging-with-flex-and-livecycle-data-services/

There’s also another recording of mine on “Message Throttling in Livecycle Data Services 3.0” at Adobe Labs:

http://labs.adobe.com/technologies/livecycle_dataservices3/videos/messagethrottling/