0

i'm here with a new question - this time more general; hope most of you have experienced this.

So than I configured my flex mobile project so that it requires to update server URL adresses each time server ip or port is changed: enter image description here

But in my case my flex mobile project will run in different hospitals that so it will need more updates each time server address is changed - and also in cases when hospital servers is restricted to outside its just impossible do that from my remote computer. As I need to update remote object classes as well: enter image description here

So, the above method seems not very suitable for my case. How can I configure my project so that I could change server url by changing the one on runtime using textareas etc. to set that as below:

enter image description here

Briefly speaking I'm talking about externalizing the configuration for AMF channel endpoint url.

Any help will be greatly appreciated !...

Zaur Guliyev
  • 4,254
  • 7
  • 28
  • 44

1 Answers1

1

You can just build the messaging consumer yourself and specify the correct channel:

function initConsumer():void { 
  var channelSet:ChannelSet = new ChannelSet();
  // for streaming
  var myChannel:Channel = new StreamingAMFChannel("streaming-channel", "http://something.com/messagebroker/");
  // for polling
  var myChannel:Channel = new AMFChannel("polling-channel", "http://something.com/messagebroker/");
  myChannel.pollingEnabled = true;

  channelSet.addChannel(myChannel);

  var consumer:Consumer = new Consumer();
  consumer.channelSet = channelSet;
  consumer.destination = "NASDAQ"; 
  consumer.selector = "operation IN ('Bid','Ask')";
  consumer.addEventListener(MessageEvent.MESSAGE, messageHandler); 
  consumer.subscribe(); 
} 

function messageHandler(event:MessageEvent):void { 
  var msg:IMessage = event.message; 
  var info:Object = msg.body; 
  trace("-App recieved message: " + msg.toString()); 
}
Clement P
  • 3,243
  • 1
  • 19
  • 20