Hi guys.
I am trying to setup a pretty easy chat application to test the spring-flex messaging. All looks good, no exceptions (i guess), but message sent is not shown up.
When I click "Send" button, on the console I can see the following:
Mar 22, 2011 4:35:08 PM org.springframework.flex.servlet.MessageBrokerHand lerAdapter handle
INFO: Channel endpoint my-polling-amf received request.
Mar 22, 2011 4:35:09 PM org.springframework.flex.servlet.MessageBrokerHand lerAdapter handle
INFO: Channel endpoint my-polling-amf received request.
Here is my small chat app.:
services-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<services-config>
<services>
<default-channels>
<channel ref="my-amf"/>
</default-channels>
</services>
<security>
<login-command class="flex.messaging.security.TomcatLoginCommand" server="Tomcat"/>
</security>
<channels>
<channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
</channel-definition>
<channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel">
<endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
<properties>
<add-no-cache-headers>false</add-no-cache-headers>
</properties>
</channel-definition>
<channel-definition id="my-polling-amf" class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amfpolling" class="flex.messaging.endpoints.AMFEndpoint"/>
<properties>
<polling-enabled>true</polling-enabled>
<polling-interval-seconds>4</polling-interval-seconds>
</properties>
</channel-definition>
</channels>
<logging>
<target class="flex.messaging.log.ConsoleTarget" level="Warn">
<properties>
<prefix>[BlazeDS] </prefix>
<includeDate>false</includeDate>
<includeTime>false</includeTime>
<includeLevel>false</includeLevel>
<includeCategory>false</includeCategory>
</properties>
<filters>
<pattern>Endpoint.*</pattern>
<pattern>Service.*</pattern>
<pattern>Configuration</pattern>
</filters>
</target>
</logging>
<system>
<redeploy>
<enabled>false</enabled>
</redeploy>
</system>
</services-config>
flex-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:flex="http://www.springframework.org/schema/flex"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schem...-beans-2.5.xsd
http://www.springframework.org/schema/flex
http://www.springframework.org/schema/flex/spring-flex-1.0.xsd">
<flex:message-broker>
<flex:message-service default-channels="my-amf,my-polling-amf,my-secure-amf"/>
</flex:message-broker>
<!-- Messaging destinations -->
<flex:message-destination id="chat" />
</beans>
Chat.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.messaging.events.MessageFaultEvent;
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;
import mx.messaging.messages.AsyncMessage;
import mx.messaging.messages.IMessage;
import mx.messaging.events.MessageEvent;
private function send():void {
var message:IMessage = new AsyncMessage();
message.body.chatMessage = msg.text;
producer.send(message);
msg.text = "";
}
private function messageHandler(message:IMessage):void {
log.text += message.body.chatMessage + "\n";
}
private function faultHandler(event:MessageFaultEvent):void {
Alert.show("" + event.message);
}
]]>
</mx:Script>
<mx:ChannelSet id="cs">
<mx:AMFChannel url="http://localhost:8080/Chat/messagebroker/amfpolling"/>
</mx:ChannelSet>
<mx:Producer id="producer" destination="chat" channelSet="{cs}"/>
<mx:Consumer id="consumer" destination="chat" channelSet="{cs}" message="messageHandler(event.message)" fault="faultHandler(event)"/>
<mx:Panel title="Chat" width="100%" height="100%">
<mx:TextArea id="log" width="100%" height="100%"/>
<mx:ControlBar>
<mx:Form width="100%" paddingTop="4" paddingBottom="4" paddingLeft="4" paddingRight="4">
<mx:FormItem label="Message:" width="100%" direction="horizontal">
<mx:TextInput id="msg" width="100%" enter="send()"/>
<mx:Button label="Send" click="send()"/>
</mx:FormItem>
</mx:Form>
</mx:ControlBar>
</mx:Panel>
</mx:Application>
Could any one help to figure out what's wrong?
Thanks.


Reply With Quote