BlazeDS and ColdFusion

collectivemodernSoftware and s/w Development

Jun 30, 2012 (4 years and 11 months ago)

518 views

BlazeDS and ColdFusion
Kurt Wiersma

What is BlazeDS?

Installing BlazeDS inside of CF

Communicating between CF and BlazeDS

Handling realtime messages in Flex
Agenda
Who am I?

By day: developer for the American
Academy of Neurology

By night: independent consultant, Mach II
and ColdSpring contributor

AppBooster - sample/starter OO app
What is BlazeDS?

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.
Huh?
BlazeDS is...

Open source

Provides AMF (Flash Remoting) ability

Allows you to send messages to and from
Flex/AIR apps

Is a subset of the LiveCycle ES (formely
Flex Data Services)
Action Message Format (AMF)

Provides a very compact binary format for
data serialization/deserialization and
remote method invocation.

Use of AMF can significantly increase data
delivery performance compared to
applications using plain XML over HTTP or
web services

Already built into CF since version 7.0.1
Real Time Messaging

BlazeDS can receive messages from CF

Flex clients can subscribe to receive
messages from a channel

Flex client is notified almost immediately
after the message is sent
Messaging Uses

Live Auctions

Fantasy Football Drafts

Sales Dashboard with live totals

Javascript and Flex integration
Messaging Example
Installing BlazeDS w/CF 8

Download the BlazeDS binary

Read installation instructions

Shutdown CF

Replace some jar files

Edit one xml file

Restart CF
Sending Messages to BlazeDS
from CF

Not documented very well

Create a Gateway CFC to pass the
message

Need to setup an instance of an event
gateway of type “DataServicesMessaging”

Setup a Consumer in Flex
Sending a Message to BlazeDS
Sending a Message to BlazeDS
Service
CFC
Sending a Message to BlazeDS
Service
CFC
Gateway
CFC
Sending a Message to BlazeDS
Service
CFC
Gateway
CFC
Sending a Message to BlazeDS
Service
CFC
Gateway
CFC
Gateway Instance Settings
Let’s See Some Code!
Gateway CFC
Handling A Message in Flex
<mx:Consumer
id="
consumer
"
destination="
ColdFusionGateway
"
message="handleMessage(event)"
/>
private

function
handleMessage(e:MessageEvent):
void
{

var
body:String = e.message.body.MESSAGE;

var
playerTO:Player = e.message.body.PLAYERTO;
pickNotification(playerTO);
}
Resources

Sample app (CFChat)

BlazeDS Homepage
Questions? Fire Away...
Kurt Wiersma
kurtkurtwiersma.com
http://wiersmablog.com
/