//richinternet.blog

Viewing By Entry / Main
Friday, March 25, 2011
Creating Remoting channels at runtime in ColdFusion

In a recent project I had to dynamically create a Flex Remoting endpoint (Channels) at runtime in the embedded BlazeDS of ColdFusion (this was due to the fact that we did not wanted the customer to mess around with the services-config.xml file).

By default, the "ColdFusion" Remoting destination only uses a non-secure AMFChannel but we wanted to use the SecureAMFChannel on that destination as well. Usually, you'd need to edit the remoting-config.xml file, add the "my-cfamf-secure" channel to the list of channels for the "ColdFusion" destination and then restart the server. With runtime channel configuration, you can just add (or even remove) channels at runtime with no server restart. Actually, you can do anything you want as long as the BlazeDS API supports it.

In my case, I use the onApplicationStart methode of the Application.cfc to call the configureChannels method which will add the existing "my-cfamf-secure" channel to the "ColdFusion" endpoint in case it has not been done already:

<cffunction name="configureChannels" returntype="void" access="private">
   <cfscript>
   var cls = createObject("java", "flex.messaging.MessageBroker");
   var broker = cls.getMessageBroker(javacast("null", ""));
   var service = broker.getService("remoting-service");
   if (service.getDefaultChannels().size() == 1)
   {
      service.addDefaultChannel("my-cfamf-secure");
   }
   destination = service.getDestination("ColdFusion");
   if (destination.getChannels().size() == 1)
   {
      destination.addChannel("my-cfamf-secure");
   }
   </cfscript>
</cffunction>

That's it.

Dirk.

Comments

There are no comments for this entry.



Sun Mon Tue Wed Thu Fri Sat
   1234
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

About this blog
www.aws-blog.de
www.richinternet.de
www.flexforum.de
www.die-flexperten.de

AIR (10)
Apollo (3)
BlazeDS (8)
Breeze (1)
Central (5)
Cocoon P2P (1)
ColdFusion (55)
Flash (61)
Flash Media Server (8)
Flex (170)
Flex Trace Panel (6)
FXUG (3)
J2Flex (4)
MAX (31)
Mobile (1)
mxmlc (1)
Other topics (47)
Plugins (9)
Video (7)


Recent Flex Technotes
Recent ColdFusion Technotes
Recent Flash Technotes

http://www.aws-blog.de
http://www.die-flexperten.de
http://www.flexforum.de
http://www.flex.org

Aggregated by fullasagoog.com
Aggregated by MXNA

Short Mode | Full Mode

Herrlich & Ramuschkat