[rabbitmq-discuss] Urgently Need help to get RabbitMQ publishing to Flex-based subscriber
Pete Kay
petedao at gmail.com
Sat Aug 30 03:34:47 BST 2008
Hi,
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.
RabbitMQ.log says:
*error on TCP connection <0.8716.0> from 192.168.1.100:50021*
*{handshake_timeout,frame_**header}*
Here is my code, could someone help me to find out what is wrong?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" styleName="plain" creationComplete="init()">
<mx:Script>
<![CDATA[
import org.amqp.patterns.impl.SubscribeClientImpl;
import org.amqp.patterns.SubscribeClient;
import org.amqp.Connection;
import org.amqp.ConnectionState;
import org.amqp.patterns.CorrelatedMessageEvent;
import org.amqp.ProtocolEvent;
import org.amqp.Session;
import org.amqp.SessionManager;
import org.amqp.impl.SessionStateHandler;
private var subClient:SubscribeClientImpl;
protected var connection:Connection;
private var serializer:JSONSerializer = new JSONSerializer();
public function init():void {
trace("test sub init");
connection = new Connection(buildConnectionState());
subClient = new SubscribeClientImpl(connection);
* subClient.serializer = serializer;
// subClient.realm = "/data";
subClient.exchange = "gamex";
subClient.exchangeType = "topic";
sub.subscribe("SimpleQueue",onMessageArrive);*
}
public function buildConnectionState():ConnectionState {
var state:ConnectionState = new ConnectionState();
state.username = "guest";
state.password = "guest";
state.vhostpath = "/";
state.serverhost = "192.168.1.104";
return state;
}
public function onMessageArrive(event:CorrelatedMessageEvent):void {
var o:* = event.result;
}
]]>
</mx:Script>
</mx:Application>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20080830/d8d99c74/attachment.htm
More information about the rabbitmq-discuss
mailing list