<div dir="ltr">Hi,<br><br>I am sorry for emailing my question a few times. I need to get Flex to successful establish connection with RabbitMQ inside my Flex application in order to position the use of RabbitMQ in our application. I can establish a AMPQ to AMPQ connection using Java client for both publisher and subscriber, but I am not able to use Flex as the subscriber. I know I may try using FM3 to act as the subscriber, but I still think the best and most straight forward solution is to have Flex client to subscribe directly to RabbitMQ. <br>
<br>RabbitMQ.log says:
<div> </div>
<div> </div>
<div><b>error on TCP connection <0.8716.0> from <a href="http://192.168.1.100:50021/" target="_blank">192.168.1.100:50021</a></b></div>
<div><b>{handshake_timeout,frame_</b><b>header}</b></div><br><br>Here is my code, could someone help me to find out what is wrong? <br><br><br><div><?xml version="1.0" encoding="utf-8"?><br><mx:Application xmlns:mx="<a href="http://www.adobe.com/2006/mxml" target="_blank">http://www.adobe.com/2006/mxml</a>" <br>
layout="absolute" styleName="plain" creationComplete="init()"></div>
<div> <mx:Script><br> <![CDATA[<br> import org.amqp.patterns.impl.SubscribeClientImpl;<br> import org.amqp.patterns.SubscribeClient;<br> import org.amqp.Connection;<br> import org.amqp.ConnectionState;<br>
import org.amqp.patterns.CorrelatedMessageEvent;<br> import org.amqp.ProtocolEvent;<br> import org.amqp.Session;<br> import org.amqp.SessionManager;<br> import org.amqp.impl.SessionStateHandler;</div>
<div> private var subClient:SubscribeClientImpl;<br> protected var connection:Connection;<br> <br> private var serializer:JSONSerializer = new JSONSerializer();</div>
<div> public function init():void {<br> trace("test sub init");<br> connection = new Connection(buildConnectionState());<br> subClient = new SubscribeClientImpl(connection);<br><b> subClient.serializer = serializer;<br>
// subClient.realm = "/data";<br> subClient.exchange = "gamex";<br> subClient.exchangeType = "topic";<br> sub.subscribe("SimpleQueue",onMessageArrive);</b><br> }<br>
public function buildConnectionState():ConnectionState {<br>
var state:ConnectionState = new ConnectionState();<br> state.username = "guest";<br> state.password = "guest";<br> state.vhostpath = "/";<br> state.serverhost = "<a href="http://192.168.1.104/" target="_blank">192.168.1.104</a>";<br>
return state;<br> }<br> <br> public function onMessageArrive(event:CorrelatedMessageEvent):void {<br> var o:* = event.result;<br> }<br> ]]><br> </mx:Script></div>
</mx:Application><br></div>