BlazeDS and Server-Side Remoting
BlazeDS is server-based remoting and messaging technology enabling the connection of Flex/AIR applications to distributed back-end data. BlazeDS is based on Java technology and has been open-sourced by Adobe.
BlazeDS consists of three key services:
- The Remoting Service allows Flex applications to directly invoke methods of Java objects deployed on an application server.
- The Message Service provides a publish/subscribe infrastructure that allows Flex applications to publish to and subscribe to messaging end-points (enabling real-time data push).
- The Proxy Service allows Flex applications to make cross-domain service requests in a secure and controlled manner.
BlazeDS is the server-based Java remoting and web messaging technology that enables developers to easily connect to back-end distributed data and push data in real-time to Adobe Flex and Adobe AIR applications for more responsive rich Internet application (RIA) experiences.
Related Links:
- http://opensource.adobe.com/wiki/display/blazeds/BlazeDS/
- http://www.adobe.com/devnet/livecycle/articles/blazeds_gettingstarted.html
- http://livedocs.adobe.com/blazeds/1/blazeds_devguide/
-----
From http://www.adobe.com/devnet/livecycle/articles/blazeds_gettingstarted_03.html:
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="consumer.subscribe()"> <mx:Script> <![CDATA[ import mx.messaging.events.MessageEvent; import mx.messaging.messages.AsyncMessage; private function send():void { var message:AsyncMessage = new AsyncMessage(); message.body.chatMessage = msg.text; producer.send(message); msg.text = ""; } private function messageHandler(event:MessageEvent):void { log.text += event.message.body.chatMessage + "\n"; } ]]> </mx:Script> <mx:Producer id="producer" destination="tutorial-chat"/> <mx:Consumer id="consumer" destination="tutorial-chat" message="messageHandler(event)"/> <mx:Panel title="Chat" width="100%" height="100%"> <mx:TextArea id="log" width="100%" height="100%"/> <mx:ControlBar> <mx:TextInput id="msg" width="100%" enter="send()"/> <mx:Button label="Send" click="send()"/> </mx:ControlBar> </mx:Panel> </mx:Application>
Code highlights:
- On the client side, the BlazeDS Message Service API provides two classes, Producer and Consumer, which you use to publish and subscribe to a destination, respectively.
- To subscribe to a destination, you use the subscribe() method of the Consumer class.
- When a message is published to a destination you subscribed to, the message event is triggered on the Consumer.
In this example, messages are published by Flex clients. The BlazeDS Message Service also provides a Java API that allows a server-side component to publish messages to a BlazeDS destination. A third option for exchanging messages between Flex and Java applications is to map destinations to Java Message Service (JMS) topics, enabling Flex clients to publish and subscribe to JMS topics.
Using the Remoting Service, your application can directly invoke methods of Java objects deployed in your application server, and consume the return value. The method can return a value of a primitive data type, an object, a collection of objects, an object graph, and more. Java objects returned by server-side methods are deserialized into either dynamic or typed ActionScript objects.

