<div dir="ltr"><div>Hi,</div>
<div> </div>
<div>I think I am close to getting my Flex code to subscribe to RabbitMQ, but I am a bit stuck on just one thing. </div>
<div> </div>
<div>When connecting using AMPQ Flex lib, I am getting:</div>
<div> </div>
<div>Calling handleForcedShutdown from connection<br>forceClose called</div>
<div> </div>
<div>Is there any way I can turn on some kind of logging to see all the messages going in and out of RabbitMQ to debug this problem? </div>
<div> </div>
<div>Could someone please kindly help me out?</div>
<div> </div>
<div>Here is my simple Flex code for getting the published messages from the Java client:</div>
<div> </div>
<div> public class Subscriber implements BasicConsumer {<br> protected var x:String = "";<br> protected var q:String = "";<br> protected var x_type:String = "topic";<br>
protected var bind_key:String = "*"<br> protected var routing_key:String = "SimpleQueue"</div>
<div> protected var connection:Connection;<br> protected var baseSession:Session;<br> protected var sessionManager:SessionManager;<br> protected var sessionHandler:SessionStateHandler;<br>
<br> public function Subscriber() {<br> init();<br> }<br> <br> private function init () : void<br> {<br> trace("init()");<br> var state:ConnectionState = new ConnectionState();<br>
<br> state.username = "guest";<br> state.password = "gutes";<br> state.vhostpath = "/";<br> state.serverhost = "<a href="http://192.168.1.104">192.168.1.104</a>"; </div>
<div> var connection:Connection = new Connection(state);<br> var baseSession:Session = connection.baseSession;<br> var sessionManager:SessionManager = connection.sessionManager;<br> connection.start();<br>
baseSession.addEventListener(new OpenOk(), onOpenOk);<br> }<br> <br> public function onOpenOk(event:ProtocolEvent):void {<br> trace("OpenOK");<br> sessionHandler = sessionManager.create();</div>
<div> var open:Open = new Open();</div>
<div> var accessRequest:Request = new Request();<br> accessRequest.realm = "/data";<br> accessRequest.passive = true;<br> accessRequest.active = true;<br> accessRequest.read = true;<br> accessRequest.write = true;</div>
<div> var exchange:org.amqp.methods.exchange.Declare <br> = new org.amqp.methods.exchange.Declare();<br> exchange.exchange = x;<br> exchange.type =x_type; </div>
<div> var queue:org.amqp.methods.queue.Declare <br> = new org.amqp.methods.queue.Declare();<br> queue.queue = q;</div>
<div> var bind:Bind = new Bind();<br> bind.exchange = x;<br> bind.queue = q;<br> bind.routingkey = bind_key;</div>
<div><br> sessionHandler.dispatch(new Command(open)); <br> sessionHandler.dispatch(new Command(accessRequest));<br> sessionHandler.dispatch(new Command(exchange));<br> sessionHandler.dispatch(new Command(queue)); <br>
sessionHandler.dispatch(new Command(bind));<br> sessionHandler.addEventListener(new BindOk(), onBindOk);<br> </div>
<div> }<br> public function onBindOk(event:ProtocolEvent):void{<br> trace("onBindOk called");<br> var consume:Consume = new Consume();<br> consume.queue = q;<br> consume.noack = true;<br>
sessionHandler.register(consume, this);<br> };<br> <br> public function onConsumeOk(tag:String):void {<br> //consumerTag = tag;<br> trace("onConsumeOk");<br>
}<br> <br> public function onCancelOk(tag:String):void {<br> trace("onCancelOk");<br> }</div>
<div> public function onDeliver(method:Deliver,<br> properties:BasicProperties,<br> body:ByteArray):void {<br> trace("onDeliver --> " + body.readUTF());<br>
}</div>
<div> </div>
<div> </div>
<div>Thank you very much for all your kind help.</div>
<div> </div>
<div>Anne</div>
<div> </div>
<div> </div></div>