[rabbitmq-discuss] RabbitMQ Flex subscriber

Ben Hood 0x6e6562 at gmail.com
Wed Aug 27 08:26:41 BST 2008


Anne,

On Wed, Aug 27, 2008 at 7:24 AM, Pete Kay <petedao at gmail.com> wrote:

>    private function init () : void
>    {
>     trace("init()");
>     var state:ConnectionState = new ConnectionState();
>
>         state.username = "guest";
>        state.password = "gutes";
>        state.vhostpath = "/";
>        state.serverhost = "192.168.1.104";
>        var connection:Connection = new Connection(state);
>        var baseSession:Session = connection.baseSession;
>        var sessionManager:SessionManager = connection.sessionManager;
>     connection.start();
>     baseSession.addEventListener(new OpenOk(), onOpenOk);
>    }

Try using "guest" instead of "gutes" as the pasword.

>
>    public function onOpenOk(event:ProtocolEvent):void {
>     trace("OpenOK");
>     sessionHandler = sessionManager.create();
>     var open:Open = new Open();
>     var accessRequest:Request = new Request();
>     accessRequest.realm = "/data";
>     accessRequest.passive = true;
>     accessRequest.active = true;
>     accessRequest.read = true;
>     accessRequest.write = true;
>     var exchange:org.amqp.methods.exchange.Declare
>      = new org.amqp.methods.exchange.Declare();
>     exchange.exchange = x;
>     exchange.type =x_type;
>     var queue:org.amqp.methods.queue.Declare
>      = new org.amqp.methods.queue.Declare();
>     queue.queue = q;
>     var bind:Bind = new Bind();
>     bind.exchange = x;
>     bind.queue = q;
>     bind.routingkey = bind_key;
>    sessionHandler.dispatch(new Command(open));
>    sessionHandler.dispatch(new Command(accessRequest));
>    sessionHandler.dispatch(new Command(exchange));
>    sessionHandler.dispatch(new Command(queue));
>    sessionHandler.dispatch(new Command(bind));
>    sessionHandler.addEventListener(new BindOk(), onBindOk);
>
>   }


The access.request command is now deprecated, so you don't need to send it.

BTW, there is a SubscribeClient template in the AS3 library which does
all of this for you, so you don't need to re-invent the wheel.

HTH,

Ben




More information about the rabbitmq-discuss mailing list