Using the GatewayHelper object

The ColdFusion GetGatewayHelper function tells ColdFusion to create and initialize a Java GatewayHelper object that provides event gateway-specific helper methods and properties. To use this function, the event gateway must implement a GatewayHelper class. For example, an instant messaging event gateway might make buddy list management methods available in a GatewayHelper object.

The ColdFusion GetGatewayHelper function takes a single parameter, the ID of the event gateway instance that provides the helper, and returns a GatewayHelper Java object. The parameter value must be the gateway ID for the instance that is specified in the ColdFusion MX Administrator. If you do not want to hard-code an ID value in the application (for example, if your listener CFC can respond to multiple event gateway instances), get the gateway ID from the CFEvent structure of the first incoming message.

The CFML code accesses the GatewayHelper object's methods and properties using standard ColdFusion Java object access techniques, as described in Integrating J2EE and Java Elements in CFML Applications. For example, if an event gateway's GatewayHelper class includes an addBuddy method that takes a single String parameter, you could use the following code to get the ColdFusion MX XMPP or Sametime gateway GatewayHelper object and add a buddy to the buddies list:

<cfscript>
   myHelper = GetGatewayHelper(myGatewayID);
   status = myHelper.addBuddy("jsmith23", "Jim Smith", "support");
</cfscript>

View comments in LiveDocs