[rabbitmq-discuss] Urgently Need help to get RabbitMQ publishing to Flex-based subscriber
Pete Kay
petedao at gmail.com
Mon Sep 1 10:56:53 BST 2008
Hi Ben,
Thanks alot for helping me.
If I use the Java Client to connect to RabbitMQ on the same computer (Win
XP) or on another computer(Linux), it works. However, my Flex client does
not work for RabbitMQ on localhost or on another computer within the same
LAN. Here is the exact code that I am running my test on. I debugged the
Connection class, but I don't see anything wrong with it.
<?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;
import org.amqp.test.JSONSerializer;
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";
subClient.subscribe("SimpleQueue",onMessageArrive);
}
public function buildConnectionState():ConnectionState {
var state:ConnectionState = new ConnectionState();
state.username = "guest";
state.password = "guest";
state.vhostpath = "/";
state.serverhost = "127.0.0.1";
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/20080901/39cfa6fe/attachment.htm
More information about the rabbitmq-discuss
mailing list