BlazeDS

Access business functionality directly without XML conversion with Action Script Message Format (AMF). Data objects are serialized into binary format. This reduces data to be send.

The client objects have a remote server side representation which is converted automatically.

Spring configuration only

When using Spring as message catch up there is no need to change XML configuration in BlazeDS. Spring not only bootstrap BlazeDS but also manages the remoting services for BlazeDS.

Client request and server push

Both communication ways can be used. The client may request for data present at the server but when data is not ready the server may push data to the client when it is ready.

The Person case uses both ways.

Person case - Configuration 2

In the flex-application configuration is specified that Spring bootstrap the BlazeDS message broker. Default channels to use which are available via BlazeDS can also be specified.


	<flex:message-broker>
		<flex:message-service default-channels="my-springamf,my-streaming-amf,my-polling-amf"/>
	</flex:message-broker>
		

Now the Java remote services must be defined. When using annotations to define these services in Java only the component-scan has te be specified. The component-scan looks for the @Component, @Service, @RemotingDestination, etc. which are used to manage dependencies directly in Java.


	<context:component-scan base-package="nl.devoorkant.person"/>
		

In our person example also server push messaging is used so a couple of bean defintions are used to set up a data feed service.


	<!-- MessageTemplate for publishing messages -->
	<bean id="defaultMessageTemplate" class="org.springframework.flex.messaging.MessageTemplate"/>

	<!-- bean used to start and stop the data feed that pushes person data in the personFeed  -->
	<bean id="personFeedService" class="nl.devoorkant.adapter.blaze.PersonPushService">
		<constructor-arg ref="defaultMessageTemplate"/>
		<flex:remoting-destination/>
	</bean>
		

That is all for Spring configuration. Spring can now interact with BlazeDS and all remote services are specified.

While in the person example a specific Spring routing is used via the servlet mapping in BlazeDS this Spring channel must be specified and made available for access. Also the streaming channel is used, so also that channel must be set up via Spring. The channels are set up in services-config.xml.


       <channel-definition id="my-springamf" class="mx.messaging.channels.AMFChannel">
 			 <endpoint url="http://{server.name}:{server.port}/{context.root}/spring/messagebroker/amfspring" class="flex.messaging.endpoints.AMFEndpoint"/>
        </channel-definition>

        <channel-definition id="my-streaming-amf" class="mx.messaging.channels.StreamingAMFChannel">
			<endpoint url="http://{server.name}:{server.port}/{context.root}/spring/messagebroker/amfstreaming" class="flex.messaging.endpoints.StreamingAMFEndpoint" />
			<properties>
				<idle-timeout-minutes>0</idle-timeout-minutes>
				<max-streaming-clients>10</max-streaming-clients>
				<server-to-client-heartbeat-millis>5000</server-to-client-heartbeat-millis>
				<user-agent-settings>
					<user-agent match-on="MSIE" kickstart-bytes="2048" max-streaming-connections-per-session="3" />
					<user-agent match-on="Firefox" kickstart-bytes="2048" max-streaming-connections-per-session="3" />
				</user-agent-settings>
			</properties>
		</channel-definition>
		

In the remoting-config.xml the default channels can be set.


    <default-channels>
        <channel ref="my-springamf"/>
        <channel ref="my-streaming-amf"/>
    </default-channels>