Whatever message this page gives is out now! Go check it out!

setCFCMethod

Last update:
May 18, 2026

Description

Sets the name of the CFC method that processes an incoming message.

Category

Event Gateway Development

Syntax

void setCFCMethod(String method)

See also

getCFCMethod setCFCPath setCFCTimeout CFML CFEvent structure CFEvent class  in the Developing ColdFusion Applications

Parameters

ParameterDescription
method
The method in the listener CFC that ColdFusion calls to process this event. If you do not use this method in your gateway, ColdFusion invokes the onIncomingMessage method.

Usage

Gateways that use a single CFC listener method do not need to use this method if the listener CFC method is named onIncomingMessage. For the sake of consistency, Adobe recommends that any event gateway with a single listener not override this default. A gateway, such as the ColdFusion XMPP gateway, that uses different listener methods for different message types uses this method to identify the destination method.

Example

The following example code comes from the ColdFusion XMPP gateway incoming message handler. It creates a CFEvent object and sets the method that handles tests based on the message type.
CFEvent cfmsg = new CFEvent(gatewayID); cfmsg.setOriginatorID(sender); cfmsg.setGatewayType(gatewayType); if(messageType == IMessage.IM) { // default for normal messages cfmsg.setCfcMethod(onIncomingMessageFunction); } //if the message is an authorization request else if(messageType == IMessage.AUTH_REQUEST) { cfmsg.setCfcMethod(onAddBuddyRequestFunction); message = "Requesting authorization to add '" + recipient + "' to '" + sender + "' buddy list and view '" + recipient + "' presence."; } // Code snipped here for brevity.

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page