If you develop with Flash Builder and use WebORB, read on, you will greatly enjoy this new functionality. The functionality is not entirely new, we had the plugin for quite some time. The main problem most users have encountered with the plugin was the installation process. We have fully reimplemented the plugin and added better integration support in the product itself.
The plugin now can be installed using Eclipse’s standard plugin installation process. To get started, make sure to download and install the latest nightly build of the product (or version 4.5 once it becomes available). To install the plugin:
From the main menu select Help and then ‘Install New Software’
Enter the following address for the plugin’s “update site” and press Enter:
http://dev.themidnightcoders.com/fb
Select the checkbox next to “WebORB plugins for Flash Builder”. The window in Eclipse/Flash Builder should look as shown in the image below:
Click through the installation wizard to complete the installation.
Click OK if you get a security warning saying the software is unsigned.
Once the installation is complete Flash Builder/Eclipse will offer a choice of applying the changes or restarting the application. Make sure to choose the restart option.
For the instructions on how to use the plugin, see WebORB documentation:
We have updated our product build system to deliver nightly product builds to you. When you login to our download center and select WebORB for .NET or WebORB for Java, you will see a list of the nightly builds available for download. The nightly builds deliver all the latest updates and bug fixes we’re adding while working toward the next product release. Please keep in mind that the nightly builds are not certified by our QA as “production ready” code, however, the code delivered through the nightly builds does pass our minimally required set of tests.
We need your feedback
When you download and try a nightly build, please report any problems you encounter through our discussion forum (.NET forum, Java forum) or the bug tracking system.
Messaging destinations is the central concept in publish/subscribe messaging supported by WebORB. The feature is available for Flex, AIR, Javascript, native Java/Android, and .NET clients. A program can be in the role of producer or consumer (or both). Producers publish messages into a destination and consumers subscribe to receive published messages. Typically messaging destinations are registered in a configuration file (WEB-INF/flex/messaging-config.xml), however, WebORB also supports destinations created at run-time – thus called dynamic messaging destinations. The dynamic nature of the destinations can add a lot of flexibility to applications relying on publish/subscribe messaging. For instance, one can easily create a short-lived messaging destination for quick message exchange or some private messaging. The example below demonstrates Java code registering a dynamic destination using the WebORB for Java API:
package demo.messaging.destination;
import weborb.ORBConstants;
import weborb.config.FlexMessagingServiceConfig;
import weborb.config.ORBConfig;
import weborb.config.ORBServerConfig;
import weborb.management.messaging.FlexMessagingDestination;
import weborb.messaging.v3.MessagingDestination;
import weborb.messaging.v3.MessagingServiceHandler;
import weborb.v3types.core.DataServices;
import java.util.Hashtable;
public class DestinationFactory
{
public String createMessagingDestination( String name ) throws Exception
{
// create destination object. This is as basic as it gets, constructor with the destination name
MessagingDestination destination = new MessagingDestination( name );
// setup the most basic properties - the name of the class handling
// subscriptions and publications and a class where the messages are stored
// until they are retrieved by the consumers.
Hashtable properties = new Hashtable();
properties.put( ORBConstants.MESSAGE_STORAGE_POLICY, "weborb.messaging.v3.MemoryStoragePolicy" );
properties.put( ORBConstants.MESSAGE_SERVICE_HANDLER, "weborb.messaging.v3.MessagingServiceHandler" );
// register properties
destination.setProperties( properties );
// initialize handler from the properties
destination.setConfigServiceHandler();
// register the destination
DataServices dataServices = ORBConfig.getORBConfig().getDataServices();
dataServices.getDestinationManager().addDestination( name, destination );
// REGISTERING DESTINATION SO IT IS VISIBLE IN THE MANAGEMENT CONSOLE
// The following two lines are needed if you would like the destination
// to appear in the management console, therefore the code below is optional
// set the channel name, so the console knows how to connect to the destination
// in the "Test Drive" mode.
destination.setChannelName( "my-polling-amf" );
FlexMessagingServiceConfig serviceConfig = ORBServerConfig.getFlexMessagingServiceConfig();
serviceConfig.addFlexMessagingDestination( FlexMessagingDestination.getDestinationScope( destination ) );
return name;
}
}
To further demonstrate how dynamic destinations can be used with the Flex client, see the following Flex application code. The application’s workflow consists of the following steps:
User enters a name for a dynamic destination to create and pressed the Create Destination button.
Flex client invokes the createMessagingDestination Java method shown above.
When the remote method invocation returns a result, the Flex client constructs a Producer and a Consumer objects. The consumer is subscribed to the newly created destination.
When the user enters text and clicks the Send Message button, the Flex client uses the Producer object to publish the message into the destination.
The consumer object receives the message from the destination and displays it in the text area.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="100%" height="100%" creationComplete="init()">
<s:layout>
<s:FormLayout/>
</s:layout>
<s:states>
<s:State name="InitialState"/>
<s:State name="DestinationCreated"/>
</s:states>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.messaging.ChannelSet;
import mx.messaging.Consumer;
import mx.messaging.Producer;
import mx.messaging.channels.AMFChannel;
import mx.messaging.events.MessageEvent;
import mx.messaging.messages.AsyncMessage;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.remoting.RemoteObject;
import weborb.messaging.WeborbMessagingChannel;
private var remoteService:RemoteObject;
private var consumer:Consumer;
private var producer:Producer;
public function init():void
{
remoteService = new RemoteObject( "GenericDestination" );
remoteService.source = "demo.messaging.destination.DestinationFactory";
remoteService.createMessagingDestination.addEventListener( ResultEvent.RESULT, destinationCreated );
remoteService.createMessagingDestination.addEventListener( FaultEvent.FAULT, gotError );
}
private function destinationCreated( evt:ResultEvent ):void
{
currentState = "DestinationCreated";
consumer = new Consumer();
consumer.destination = evt.result as String;
//var channel:AMFChannel = new AMFChannel( "custom-amf-channel", "weborb.wo" );
var channel:WeborbMessagingChannel = new WeborbMessagingChannel( "custom-rtmp-channel", "rtmp://localhost/root" );
var channelSet:ChannelSet = new ChannelSet();
channelSet.addChannel( channel );
consumer.channelSet = channelSet;
consumer.addEventListener( MessageEvent.MESSAGE, gotMessage );
consumer.subscribe();
producer = new Producer();
producer.destination = evt.result as String;
producer.channelSet = channelSet;
}
private function gotError( evt:FaultEvent ):void
{
Alert.show( "Server reported an error: " + evt.fault.faultDetail );
}
private function createDestination():void
{
remoteService.createMessagingDestination( destinationName.text );
}
private function sendMessage():void
{
var asyncMessage:AsyncMessage = new AsyncMessage( messageText.text );
producer.send( asyncMessage );
}
private function gotMessage( evt:MessageEvent ):void
{
log.text = evt.message.body.toString() + "\n" + log.text;
}
]]>
</fx:Script>
<s:HGroup width="100%" paddingBottom="2" paddingTop="2" verticalAlign="middle">
<s:Label width="150" text="Destination Name:"/>
<s:TextInput id="destinationName"/>
<s:Button label="Create Destination" click="createDestination()"/>
</s:HGroup>
<s:HGroup width="100%" paddingBottom="2" paddingTop="2" verticalAlign="middle">
<s:Label width="150" text="Message:"/>
<s:TextInput id="messageText"/>
<s:Button label="Send" click="sendMessage()" enabled="false"
enabled.DestinationCreated="true"/>
</s:HGroup>
<s:HGroup width="100%" height="200">
<s:TextArea id="log" width="413" height="100%"/>
</s:HGroup>
</s:Application>
Since the client code references the weborb.messaging.WeborbMessagingChannel class (needed only if the client-server publish/subscribe communication should be done via RTMP), the application must reference weborb.swc in the Flash Build Path of the project. The library is available at:
WebORB for Java – [WEBOBR INSTALL DIR]/webapp/weborbassets/wdm
WebORB for .NET – [WEBOBR INSTALL DIR]/weborbassets/wdm
Flex provides many benefits and advantages over alternative client-side technologies. In my opinion one of the most powerful features available in Flex (and Flash) is the support for video streaming and recording. To make it easier for developers to include these (and many other RTMP-based) features, we added a very cool code generator into the latest releases of WebORB for Java and .NET. With a few mouse clicks the code generator can instantly create a complete Flex project containing all the ActionScript code enabling video recording, video broadcast, communication via remote shared objects and server-side data push. The video linked below provides an overview of this fantastic functionality. Enjoy!
In my previous post I shared an example showing data paging for flex. The most important subfeatures of our ‘managed data paging’ feature are:
Loosely coupled interface – the feature will work without implementing a specific server-side interface and can be used with Java, .NET and PHP
Can be used with ANY Flex data component (applicable to both MX and Spark architectures)
Memory management – our data provider will maintain only specific number of pages in memory and will re-fetch data on as needed basis
We put together another example visualizing how memory management work. The example works with a database table containing 2.6 million records. Any time a page of data is loaded or removed from memory, the visualization component reflects it by drawing or removing a line. You can see the example in action in the video below. The source code and the database script are available at the bottom of the post. Enjoy!
Loading too much data into a Flex application can easily present a problem. Flex data components like lists or datagrids do not deal with very large data providers very well. Additionally, fetching a lot of data from the server may have a significant impact on the application’s performance as the client-side memory footprint of the application can grow to be quite large. A common solution for these problems is data paging. The entire dataset is split into blocks (pages) and a page of data is loaded on the as-needed basis (for example, when the application user tries to scroll through the data in a datagrid).
To simplify this task for Flex developers, we introduced an API and a Flex data component which makes it possible to dynamically fetch data from Java. .NET or PHP services. The component can be used as a data provider for any Flex data-bound UI component. Additionally, we implemented a very powerful memory management system which makes sure that only specified number of pages is kept in memory. That way, you can easily visualize a data set with millions of records in a single data grid without loading all the records into memory.
Create ‘findharley’ database schema (database) and restore the database by using the SQL script. The server side code uses the root/sa userid and password. You can grant access permissions for the database to another user and modify the Java code to use different credentials.
Compile the server-side code. Make sure to update the JDBC connection string with the updated userid and password – line 221 in FHService.java (see the item above).
The compiled server-side code can be deployed as .class files into WebORB’s WEB-INF/classes folder or as a jar file into WEB-INF/lib
Open the client-side project in Flash Builder, adjust the server-side path, the path to weborb-services-config.xml for the -services compiler argument and Flash Build Path.
One of the new features we added into the version 4.3 of WebORB for Java is support for the Robotlegs framework. The framework is becoming quite popular among ActionScript developers and we see it used quite often. The new feature lets you generate all the supporting Robotlegs ActionScript code for any Java service supported by WebORB. The list of services includes POJOs, EJBs, Spring beans, Grails services and SOAP web services. The video below includes a demonstration of the feature. Enjoy!
I am very happy to report that we released a new version of WebORB for Java – version 4.3. The theme of the release is ‘Developer Productivity’. As you may already know, WebORB enables integration at four different levels: remoting (RPC), data management, real-time publish/subscribe messaging and video/audio streaming and recording. With this release, we deliver code generators for all of these levels of integration. Below is a brief description of the new features you will find in 4.3:
Data management for JavaScript Clients – If you’re familiar with WebORB, more than likely you know about our data management framework. If not, then you can learn about it either from the WebORB Data Management documentation or the Data Management webinar recording. In short, the framework lets you quickly import your database schema into our Data Modeller tool and generate client and server-side code to enable full CRUD with your data from the ActionScript or JavaScript client or the server-side code. The same code generator can also create a demo application which demonstrates the power of the API. The JavaScript client support lets you create a data-driven ORM solution for your database in seconds. In addition to the APIs for CRUD operations, the JavaScript client also supports client-synchronization for the changes done by other clients working with the same dataset.
Remoting code generator for Robotlegs - Robotlegs is quickly becoming a popular ActionScript framework. We included a very powerful code generator which can generate all the supporting ActionScript classes for a given Java service (POJO, EJB, Spring bean, Grails service or SOAP web service) . The generated code enables remoting with the service and includes all the supporting classes conforming to the Robotlegs framework. This includes controller, events, mediators and ActionScript value objects. Read more about WebORB and Robotlegs integration.
Native Android Java code generator and invocation client - WebORB includes a tiny native Java library supporting remote procedure calls of the WebORB hosted services from native Android Java applications. Additionally, we also added a code generator which can create Java client-side code for any given WebORB service. The generated project also includes a visual invoker to make it easier to see the generated code in action.
Windows Phone invocation client (with code generator)- similar to the native Android Java library, we also added a native Windows Phone (Silverlight) client-side library into the WebORB distribution. Using the library Windows Phone applications can easily integrate with WebORB-hosted Java services using either RPC or publish/subscribe APIs. There is also a code generator which can create C# code and a sample Windows Phone project for any deployed Java service.
New Swiz code generator – We have completely rewritten the Swiz code generator to support the latest release of the Swiz framework. The generated code includes all the events, pre-wired controller, service invoker and value object types.
Code generator for rich media Flex, AIR and Mobile apps – WebORB for Java supports the RTMP protocol and enables video streaming and recording, remote shared objects and server-side data push. In this release we added a code generator which can create a sample Flex, AIR or mobile application with the code demonstrating all of these features. Optionally, the code can be generated to support RTMP tunneling for any of the selected features. Read more..
Code generator for multi-client Publish Subscribe messaging – WebORB provides native libraries and APIs for publish/subscribe messaging for Flex, AIR, JavaScript, native Java and .NET clients. The unifying concept for all of these APIs is the messaging destination. With the new release, it is trivially easy to manage destinations and on top of this, developers can quickly generate native publish/subscribe messaging apps for all the supported client-side types.
Publish/Subscribe Messaging Test Drive – When you develop a messaging application, it may be very important to be able to observe message traffic over your destination. It is very easy to do that with the new release. Simply open the management console, Find your destination under the Messaging Server tab and click “Test Drive”. The feature lets you both create subscribers and publish test messages.
As you can see it is a feature packed release. We also fixed quite a few bugs and you can access a full report in the Midnight Coders bug tracking system. We plan to publish follow-on posts with videos and examples demonstrating all the new functionality in the coming days.
The example reviewed below demonstrates data push from a server-side Java application to three different native mobile app implementations: iOS, Android and Windows Phone. The server updates the data every 1.5 seconds and delivers it to the clients. The iOS client uses a persistent RTMP connection, the Android and Windows Phone clients use publish/subscribe messaging (via polling) to receive server-side updates. The source code for each mobile implementation and the server-side project (with deployment instructions) is available below the video:
Server-side Compilation and Deployment instructions:
Download and install WebORB for Java (make sure to download version 4.3 or above) .The product is available for free with the Community Edition license. Without a license key, it will work in the “development mode” which will be sufficient to the this example. See WebORB Licensing for additional details.
To compile the Java project, add the following JAR dependencies: weborb.jar, red5.jar, spring-core-3.0.0.jar. All the required jar files can be found in [WEBORB-INSTALL-DIR]/webapp/WEB-INF/lib.
The compiled classes can be deployed to [WEBORB-INSTALL-DIR]/webapp/WEB-INF/classes/examples/weborb (if the package structure changes, the directories under WEB-INF/classes will have to change as well).
Register new messaging destinations. To do this, open [WEBORB-INSTALL-DIR]/webapp/WEB-INF/flex/messaging-config.xml in a text editor, add the following destination declaration before the closing </service> element, then save the file:
Register new RTMP messaging application: To do this create a new XML file with the following contents in [WEBORB-INSTALL-DIR]/webapp/WEB-INF/classes. Name the file stockexchange-web.xml (alternatively, you can download the file from here):
Modify beanRefContect.xml from [WEBORB-INSTALL-DIR]/webapp/WEB-INF/classes by adding the following XML element before the closing </list> element.
<value>stockexchange-web.xml</value>
Run WebORB for Java in a command prompt/terminal window by using the following command (run the command from the WebORB installation directory):
java -jar weborb.jar
Verify that WebORB is running by opening the management console from: http://localhost:8080
Compile and run the mobile applications. Use the following configuration parameters:
iOS – Hostname: if launching in iOS Simulator, use localhost, otherwise enter IP address of the machine where weborb is running. Application name: StockExchange, port – 1935
Android and Windows Phone- WebORB URL – http://localhost:8080/weborb.wo (if running on a device, substitute localhost with the IP address of the machine where WebORB is running).
This is just a heads-up that we finished an implementation of a binary remoting protocol for our new Communication Library for iOS. The new feature provides a way to integrate iOS applications with Java, .NET and PHP backends. The next release of the library is a few days out and will enable extremely fast remote procedure call (RPC) support for POJOs, Java Spring beans, EJBs, Grails services, SOAP Web Services, .NET classes, WCF services, Spring.NET beans and PHP classes. We’re also working on a benchmark application which will demonstrate how our implementation stacks up against currently available integration approaches like JSON or SOAP. Stay tuned, the client-server integration for native iOS apps is about to change.