I have a flex project using BlazeDS where I am trying to create a 
message destination dynamically and then subscribe to it in Flex.  
I've been using the sample from Blaze as a reference.

Java method returns the string of the new destination:
...
ms = (MessageService) MessageBroker.getMessageBroker(null).getService
("message-service");
MessageDestination destination = (MessageDestination) 
ms.createDestination(dStr);
                
if (ms.isStarted())
{
   System.out.println("Starting Destination " + dStr);
   destination.start();
}
... 
return dStr;

In Flex, this Java method is called through a RemoteObject and the 
handle on the result does the following:
var consumer:Consumer = new Consumer();
if (event.result != null){
   var destination:String = event.result as String;
   var myStreamingAMF:AMFChannel = new StreamingAMFChannel("my-
streaming-amf", "../messagebroker/streamingamf");
   var myPollingAMF:AMFChannel = new AMFChannel("my-polling-
amf", "../messagebroker/amfpolling");
   myPollingAMF.pollingEnabled = true;
   myPollingAMF.pollingInterval = 2000;
   var channelSet:ChannelSet = new ChannelSet();
   channelSet.addChannel(myStreamingAMF);
   channelSet.addChannel(myPollingAMF);
   consumer.channelSet = channelSet;                    
   consumer.destination = destination;
   consumer.addEventListener(MessageEvent.MESSAGE, handleMessage);
   consumer.subscribe();
}
Alert.show("Subscrided: " + consumer.subscribed);

The Alert box is showing the consumer is not subscribed.  I've traced 
through and everything looks ok.  Anyone know what I am doing wrong?

Thanks
Dom

Reply via email to