The Networking Architecture of BlazeDS BlazeDS provides a clean separation of the Selection from Agile Enterprise Application Development with Flex [Book]. In this example I am going to use Spring+BlazeDS integration API for integrating backend Spring based J2EE layer into client layer Flex. So the User Interface is produced using Flex and to take care of the remoting we can use BlazeDS which is Open Source from Adobe. BlazeDS.
|Published (Last):||26 April 2009|
|PDF File Size:||6.39 Mb|
|ePub File Size:||19.61 Mb|
|Price:||Free* [*Free Regsitration Required]|
Learn about Adobe’s tool for coupling together Flash platform-based interfaces with robust Java enterprise servers. It enables remote procedure calls and message exchanges between the two platforms thereby helping couple together rich and engaging Flash platform based interfaces and robust enterprise servers. Being open source, BlazeDS is freely available and can be downloaded from http: This Refcard provides a quick overview of BlazeDS.
It attempts to illustrate some of the most important features of the software and therefore acts as a starting point for developers who are interested in the subject. Although it’s mentioned upfront that BlazeDS helps connect Flash platform applications to Java, it’s important to define it a bit further. Therefore both its behavioral and structural aspects are tersely listed in this section.
With the definition of BlazeDS firmly in place, it’s worthwhile to explore Flex client and Java server integration in the larger context of combining the two platforms. Look at the next two figures for some insight into the context.
Installing BlazeDS is as simple or as complex as deploying a web application in a Java servlet container. You can get both compiled and source versions of the software. Glex addition, one of the binary versions comes in the form of a turnkey distribution that includes a configured copy of the Apache Tomcat Servlet container within the bundle.
For beginners, it’s convenient, appropriate and advisable to get the latest release version of the binary turnkey distribution. Simply put, at the heart of BlazeDS is a Servlet that bootstraps the infrastructure that intercepts all calls between a Flex client and the BlazeDS instance. This Servlet, called MessageBrokerServlet, uses artifacts like channels, endpoints, and adapters to enable proxy, remoting, and messaging services.
A default configuration file, called services-config. Channels blazedx endpoints connect a Flex client to a BlazeDS server. They are the primary components that enable communication between these two entities. Endpoints reside at the BlazeDS end. Flex clients use channels to connect to bllazeds endpoints. The BlazeDS endpoints are Servlet-based endpoints.
Each endpoint defines a type and format of communication. Analogously, the Flex client defines a set of channels that vary depending on the type and format of communication. Matching endpoints and channels are paired, and that’s when a Flex client and BlazeDS server talk to each other. The binding of channels and endpoints to their implementation classes and their pairing is done in the services-config.
In addition to the endpoints, BlazeDS includes adapters that provide the critical compatibility between the core BlazeDS Servlet that talks to Flex and a server-side resource such as a JMS resource, a persistent data store, or an Object-Relational mapping layer. Adapters are also configured in services-config. The configuration file services-config. The top level and the first of these four is services-config. The other three are as follows:. Remoting-config, proxy-config and messaging-config contain configuration pertaining to remote procedure calls, proxy services and message services respectively.
Explaining every bit of the configuration is beyond the scope of this Refcard and is therefore not included. Only a couple of quick examples are shown to give you a flavor the typical configuration elements. With these brief configuration examples in place, let’s explore BlazeDS’s pull-based or request-response based communication abilities.
The following sections include a few more in context configuration illustrations. Off the shelf, the Flex framework includes three methods of pull-based communication and data interchange with external data sources:. Using BlazeDS’s demoting you are enabled with automatic translation between the Java and ActionScript3 AS3 data types, marshaling, un-marshalling, serialization and deserialization across the endpoints and channels.
BlazeDS’s demoting capabilities provide fast and efficient data transmission between a Flex client and a Java server with the help of the binary Action Message Format AMF protocol and the built-in endpoints, channels and adapters to support it.
Spring + BlazeDS Integration API for Flex based Enterprise Apps | ravigeek
Adapters make it possible to hook-up specific server side entities. The JavaAdapter included in the configuration example, is a built-in adapter for plain Java objects, which are also sometimes referred to as POJOs.
For accessing managed entities like Spring Beans or Enterprise Java Beans EJBsyou can use the JavaAdapter as the translator but you also need a custom factory to help entefprise access these objects, as managed objects reside in a namespace separate from the one that BlazeDS uses to instantiate its own objects.
Besides, demoting BlazeDS can also act as a proxy server and help access data from domains that are not explicitly trusted via a crossdomain. Among others, the BlazeDS proxy capabilities have three important use cases including:. Data pushing in a web wuth context implies the server sending data to a browser-based client without the client necessarily requesting it. Long polling can provide near real-time data push by waiting till the response from the server is ready to be dispatched.
It’s not scalable though, as it blocks connections. The RTMP specification was proprietary until the beginning of this year and has most recently been opened up to public.
Its inclusion into future versions of BlazeDS is anticipated.
Usage of Java NIO provides for scalable connections as blocking connections are replaced by non-blocking asynchronous counterparts. BlazeDS does not include Java NIO implementations for its communication channels but it’s f,ex very difficult to include one. The open source dsadapters project http: Messaging systems involve two typical messaging domains: BlazeDS can logically support both messaging domains.
It has first-class support for publish-subscribe messaging domain. The ActionScriptAdapter helps route messages between Flex clients via the server. Therefore JMSAdapter comes handy when Flex clients are wired up to send and receive messages to and from enterprise systems that use JMS, whereas ActionScriptAdapter is useful for building systems like chat applications entrrprise help communicate between two Flex clients. Enrerprise client sends a recurring request to the server at a predefined frequency.
Polling is very resource and network intensive. The channel issues polls to the server to fetch data but if no data is available it waits until data arrives for the client or the configured server wait interval elapses. For high frequency updates this configuration has the overhead of a poll roundtrip for every pushed message aith therefore messages can be queued between polls. This channel opens an HTTP connection between the server and client, over which the server sends an unending response of messages.
This channel avoids the overhead of polling and keeps the connection open for the entire scope of communication between the client and flxe server.
Extending the scope of these frameworks to include interactions with Flex clients allows seamless persistence management. The dsadapters project http: BlazeDS is capable of serializing and transforming Java-based objects to their AS3 counterparts so that may make you wonder why wiring up JPA and Hibernate entities and their collections needs any special etnerprise.
The reason for this special need arises because of the way BlazeDS serializes data across the wire. BlazeDS has a set of endpoints where tlex Flex application fled sends requests up to BlazeDS that resides within a Servlet container or an application server.
Responses from BlazeDS follow the route back up from the endpoint to the channel. On endpoints that support translation and serialization between AS3 and Java or even web servicesa serialization filter is defined to intercept calls to the endpoint.
When an incoming or outgoing message hits the filter, serialization and deserialization occur. During serialization, the serializer eagerly fetches all the JPA and Hibernate persistent objects and sends them across the wire. The JPA and Hibernate proxies are replaced with the data that they stand in place of.
This breaks the lazy loading semantics, rendering the idea of proxies useless. Therefore, any Hibernate adapter needs to preserve the proxy characteristics while keeping the standard behavior of the essential serialization and deserialization mechanism between Flex and Java intact. A common design pattern used to solve this problem is what I like to call the “Clone and Merge Transfer Pattern.
Prior to the existence of this project developers relied on custom factories to integrate Spring and BlazeDS.
BlazeDS is a Java Servlet based web application, so it integrates and works with the Spring framework facility that addresses the web layer. This means you must have a enterprsie that all requests coming from the Flex client and intended to be handled by the BlazeDS instance are routed by the DispatcherServlet to the MessageBroker. This is exactly what the Spring BlazeDS project implements.
More about the possible configurations can be learned online at http: With the help of this project it becomes easy to configure Spring Beans as server side remoting counterparts of Flex clients.
Can easily be used as a remoting destination simply by specifying a configuration as follows:. There is plenty more, including use of annotations, possible for configuring Spring Beans as remoting destinations and you may want to learn more online from the Spring BlazeDS project site mentioned earlier in this paragraph.
Besides, remoting the Spring messaging and security benefits also get extended to Flex applications. In a Spring BlazeDS enterpris, three types of message service components can interact with the Flex message service.
The messaging service in Flex itself is agnostic enterprkse the messaging protocol used on the server side. Therefore, multiple server-side messaging alternatives easily work with Flex messaging.
Getting Started with BlazeDS
The three alternative serverside message services in Spring BlazeDS are:. ServiceAdapter abstract class sits at the root of the hierarchy. All built-in adapter classes inherit from the ServiceAdapter abstract class. Abstract classes not only define a contract like interfaces do but also define behavior through partial method implementations.
In web scale applications scalability is an important criteria for success. BlazeDS instances can be clustered and the following techniques can be applied to make applications scale better:. Clustered instances of BlazeDS share data and messages across instances. Therefore, message producers connected to a clustered server instance can send messages to message consumers connected to a different server within the same cluster. Besides sharing state information and routing information through the clustered servers, clustering provides for channel failover support.
Flex blazeds/lcds AMF serialization for transie | Adobe Community
BlazeDS is a Java Servlets based web application. As data from a BlazeDS server leaves for fex Flex client, it can be intercepted using the familiar Java Servlet filter mechanism.
Servlet filters can intercept requests to and responses from a Java Servlet.