Flex Remoting and Messaging

  • 5,869 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
5,869
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
0
Comments
0
Likes
4

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Integrating Flex using AMF
    Remoting & Messaging in Flex
    Christopher Grant - crgrant@gmail.com
    1/20/2010
  • 2. Agenda
    What is AMF
    Data Integration Options in Flex
    Capabilities of AMF
    Why it is useful
    Benefits of AMF
    Where to get it
    Server Side Options for AMF
    How to use it
    Terminology
    Configuration
    Examples
    Simple Remoting
    Simple Messaging
    Custom Objects
  • 3. What is it
  • 4. Data Integration Options
    Hyper Text Transfer Protocol – HTTP
    HTTPService
    Simple Object Access Protocol – SOAP
    WebService
    Action Message Format – AMF
    Remoting
    RemoteObject
    Messaging
    Consumer
    Publisher
  • 5. AMF Capabilities
    Remoting Services allow your Flex application to directly invoke methods of Java objects deployed in your application server.
    Message Services provide a publish/subscribe infrastructure that enables your Flex application to publish messages and subscribe to a messaging destination, enabling the development of real-time data push and collaborative applications. 
  • 6. Why use it
  • 7. Benefits of AMF
    Binary transfer is faster than text
    Objects are very small and are compressed using zlib
    Fast Serialization/ Deserialization
    Designed to serialize and deserialize quickly under low memory and slower CPU conditions
    AMF data is parsed directly into objects, meaning there is no lag for interpretation or parsing
    ActionScript Object format
    Support for Native Types and Custom classes
  • 8. Where to get it
  • 9. ServerSide AMF Options
    PHP: Zend, AMFPHP, WebOrb for PHP, SabreAMF
    Java: BlazeDS*, Red5, GraniteDS*, WebOrb for Java
    .Net: FluorineFx*, WebOrb* for .Net, AMF.NET
    Python:PyAMF
    Ruby on Rails: RubyAMF, WebOrb for Ruby on Rails
    ColdFusion: Built in*
    * indicates push / messaging capabilities
  • 10. How do you use it
  • 11. Terminology
    Channel
    Protocol-based conduits
    Channel Sets
    Improves the quality of service in the face of network failures or individual Channel problems
    Endpoint
    The server interface responsible for encoding and decoding data into messages
    Destination
    Client side reference to resources used for both publish-subscribe and point-to-point messaging
    Polling vs Streaming
    Polling opens & closes the connection by message
    Streaming keeps the connection open at all times
  • 12. Channels, Set and Endpoints Oh MY!
    Client
    Destination
    EndPoint
    Channel
    Streaming
    Destination
    Destination
    EndPoint
    Channel
    Streaming
    Channel Set
    Destination
    EndPoint
    Channel
    Polling
    Destination
  • 13. Configuration
    Code based
    AS and MXML
    Config Files
    services-config
    ToolKit
    Swiz
  • 14. Config Files
    Services-config
    Need to tell flex where it is
    Setup with IDE Wizard
    Setup Manually
    Flex Compiler arguments: -services "C:....”
    Pointers to
    remoting-config.xml
    proxy-config.xml
    messaging-config.xml
    Used by Client and Server
  • 15. Config File Excerpt
    Services-config.xml

    <service-include file-path="remoting-config.xml" />

    <channel-definition id="channel-amf“ class="mx.messaging.channels.AMFChannel">
    <endpoint
    url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf"
    class="flex.messaging.endpoints.AMFEndpoint" />
    </channel-definition>
    Remoting-config.xml
    <service id="remoting-service“ class="flex.messaging.services.RemotingService“>

    <destination id="HelloWorld">
    <properties> <source>com.grant.Thing</source> </properties>
    <channels> <channel ref="channel-amf" /> </channels>

    </destination>

    </service>
  • 16. Simple MXML Excerpt
    <mx:RemoteObject
    id=“myRemoteObject"
    destination="HelloWorld"
    result="resultHandler(event)"
    fault="faultHandler(event)" />
    <mx:Buttonlabel=“SayHello“
    click=" myRemoteObject.getOperation(“SayHello”).send();" />
    private function resultHandler(evt:ResultEvent):void
    {
    resultTxt.text= evt.result.toString();
    }
  • 17. Real Examples
    Let’s look at code already…geez!