how to push data from BlazeDS without receive message from Flex client?

前端 未结 3 562
温柔的废话
温柔的废话 2020-12-10 08:34

I am using BlazeDS for data-push feature in my Flex application project. From the official tutorial, Getting started with BlazeDS, it shows messaging example with producer/c

3条回答
  •  不思量自难忘°
    2020-12-10 09:33

    If you want to set the url to the stream at runtime do the following:

    //assumes _consumer is an instance variable mx.messaging.Consumer
    var channelSet:ChannelSet = new ChannelSet();
    //change {server.name}:{server.port} to the end point you wanna hit
    var ep:String = "http://{server.name}:{server.port}/messagebroker/streamingamf";
    var channel:StreamingAMFChannel = new StreamingAMFChannel("my-streaming-amf", ep);
    channelSet.addChannel(channel);
    
    _consumer = new Consumer();
    _consumer.channelSet = channelSet;
    _consumer.destination = "TestServiceAdapterDestination";
    _consumer.subscribe(); 
    _consumer.addEventListener(MessageEvent.MESSAGE, onMsg); 
    _consumer.addEventListener(MessageFaultEvent.FAULT, faultHandler); 
    

    Just a heads up. This took some head banging to get going. I hope it helps someone.

提交回复
热议问题