Description

Returns the data Map that contains the message contents and other gateway-specific information.

Category

Event Gateway Development

Syntax

Map getData()

See also

setDataCFML CFEvent structureCFEvent class in Event gateway elements in the Developing ColdFusion Applications

Returns

The event data structure, or null. This structure includes the message contents being passed by the gateway and any other gateway-specific information.

Usage

The contents of the data Map depends on the event gateway type. Typical fields include the message contents, originator ID, destination ID, and if a gateway (such as the ColdFusion SMS gateway) supports multiple commands, the command.

Note: The returned Map object has case-insensitive keys.

Example

The following outgoingMessage method from the SocketGateway example gateway gets the message contents from the CFEvent data field of an outgoing message. If the CFEvent object does not include an OriginatorID field, it also tries to get the originator ID from the data field.

public String outgoingMessage(coldfusion.eventgateway.CFEvent cfmsg)
{
String retcode="ok";
// Get the table of data returned from the event handler
Map data = cfmsg.getData();
String message = (String) data.get("MESSAGE");
// find the right socket to write to from the socketRegistry hashtable
if (cfmsg.getOriginatorID() != null)
((SocketServerThread)socketRegistry.get(cfmsg.getOriginatorID())).
writeOutput(message);
else if (data.get("OriginatorID") != null)
((SocketServerThread)socketRegistry.get(data.get("OriginatorID"))).
writeOutput(message);
else {
System.out.println("cannot send outgoing message. OriginatorID is not
available.");
retcode="failed";
}
return retcode;
}

 

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy